@Gatesunder
Just another bit in the byte
Something
Something
No blogs yet.
Do you want to work on a project or platform that is already established, or do you want to roll your own blockchain? I assume you'd want the former, so in that case head on over to github and find the repositories for your favorite cryptocurrencies and go from there, using the languages they're using. With Bitcoin, this is C++ at the contributor level, or bitcoin script at the higher level. With RSK (rootstock), the platform being built for smart contracts on bitcoin, this is apparently solidity? I haven't kept up, but I guess that's the route they went down to ease transfer of developer knowledge in order to convert ethereum developers. For Lisk, I believe they just use plain old javascript. For Cardano, I think they use a special language similar to haskell, called Plutus? The focus of Cardano is on provable security, because one of the greatest weaknesses right now in the ICO space are insecure smart contracts. Bitcoin solves this by making it so that bitcoin script isn't Turing Complete, while Cardano wants to have more of what Ethereum has. I think the most potential right now is with either Bitcoin or Cardano: https://cardanodocs.com/technical/plutus/introduction/
Yes, I would. When many people get into programming, their closest interactions with technology come in the form of some user interface, so there's a high likelihood that they're coming into programming thinking "I'd like to make these sorts of applications" referring to either web apps, video games, or native mobile apps. Well, the simplest way to set them on that path is one that offers encouragement along the way instead of frustrating headaches dealing with the higher efforts and lower rewards that come from any other means of implementing a user interface. Motivation is a highly underrated aspect of learning, and not everyone can endure the self-flagellation required from trying to program something useful in C++ or Java. Additionally, learning to program in a language like C++ comes with some mental baggage that is hard for people to shed; namely an overemphasis on efficiency and overthinking microscopic aspects of the application rather than grasping the application as a whole. For these reasons, I think Javascript is the best choice as a first language.
I'm not sure how good / useful this is, but I was recently reading up on RAML, which is a YAML based language for describing REST APIs. You can combine that with this tool, osprey , to generate express router middleware from said RAML. If you give it a go, let me know how well / un-well it worked, and whether that's what you were looking for?
For some reason I misread the question at first (distracted by heart burn, let's go with that as my excuse). I read it as them giving birth every 7 years instead of starting to give birth at age 7, and somehow also skipped the part about maxAge of 40 and assumed maxAge of 30. So, here's the incorrect code I wrote that solves a slightly different problem: let max = 30 let size = 1 let period = 7 let count = 1 let years = 100 let hat = new Set () let genesis = { age: 0 , max: 30 , size: size, period: period, children: new Set () } hat.add (genesis) function isDead ( entity ) { return (entity.age >= entity.max) } function birthReady ( entity ) { return (entity.age % entity.period == 0 ) } for ( let i = 0 ; i < years; i++) { hat.forEach (rabbit => { rabbit.age++ if (isDead (rabbit)) { hat.delete (rabbit) count-- } else { if (birthReady (rabbit)) { for ( let j = 0 ; j < rabbit.size; j++) { let child = { age: 0 , max: max, size: size, period: period, children: new Set () } rabbit.children.add (child) hat.add (child) count++ } } } }) } console .log (genesis) console .log (count) I'll refactor it a bit to solve the actual problem in a moment. EDIT 1: Fixed, but horribly inefficient for the task at hand: let max_birth = 30 let max_age = 40 let birth_start = 7 let size = 1 let period = 1 let count = 1 let years = 100 let hat = new Set () let genesis = { age: 0 , birth_start: birth_start, max_birth: max_birth, max_age: max_age, size: size, period: period, children: new Set () } hat.add (genesis) function isDead ( entity ) { return (entity.age >= entity.max_age) } function birthReady ( entity ) { return ( (entity.age % entity.period == 0 ) && (entity.age <= entity.max_birth) && (entity.age >= entity.birth_start) ) } for ( let i = 0 ; i < years; i++) { hat.forEach (rabbit => { rabbit.age++ if (isDead (rabbit)) { hat.delete (rabbit) count-- } else { if (birthReady (rabbit)) { for ( let j = 0 ; j < rabbit.size; j++) { let child = { age: 0 , birth_start: birth_start, max_birth: max_birth, max_age: max_age, size: size, period: period, children: new Set () } rabbit.children.add (child) hat.add (child) count++ } } } }) } console .log (genesis) console .log (count) Going to Refactor again with something more efficient. BRB ... EDIT 2: Completely refactored and a lot more efficient: let options = { birth_start: 7 , max_birth: 30 , // age agter which entity stops birthing max_age: 40 , // age after which entity dies litter_size: 1 , birth_period: 1 , years: 100 , } let dead_entities = {count: 0 } let entities = Array (options.max_age + 1 ).fill ( 0 ) entities[ 0 ] = 1 function year ( entities, dead_entities, options ) { dead_entities.count += entities [options.max_age] for ( let i = options.max_age; i > 0 ; i--) { entities [i] = entities [i - 1 ] } entities [ 0 ] = 0 let birth_range = ( options.max_birth < options.max_age ? entities.slice ( options.birth_start, options.max_birth + 1 ) : entities.slice (options.birth_start) ) let new_entities = 0 for ( let i = 0 ; i < birth_range.length; i++) { if (i % options.birth_period == 0 ) { new_entities += birth_range [i] * options.litter_size } } entities [ 0 ] += new_entities } for ( let i = 0 ; i < options.years; i++) { year (entities, dead_entities ,options) } console .log ( "alive: " , entities.reduce ((population, cohort) => population + cohort) ) console .log ( "dead: " , dead_entities) The only thing I don't like about this solution is it's readability.
Use github webhooks. They ping an address / url with specific updates you want it to listen for. On the server side you have a simple server listening which validates the ping to make sure it's coming from github, and if valid, you use the payload in whichever way necessary. For instance, if the ping is simply to tell your server that the repo branch was updated, then that would just trigger your server to perform a git pull on that branch.
OOP is a way of thinking about data where the data is forcefully bonded to the functions that manipulate said data. Access specifiers are mostly just enforced documentation for how your code is used, and I don't think they're necessary when adding ingredients to the OOP soup so to speak. Given that way of thinking about OOP, javascript has everything else you mentioned. In a way you can think of javascript as "unopinionated OOP" just like it's "unopinionated FP"; it gives you flexibility. Also, I don't think you should go around calling yourself a Functional programmer or an object oriented programmer, any more than a carpenter calls themselves a hammerer or a sawer; they're just tools in the tool box.