Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Node Way

Fred K. Schott
December 30, 2014

The Node Way

Node.js has always been easy to grasp, but difficult to master. Design patterns and best practices exist for avoiding common pitfalls and building more stable applications, but these guiding principles have never been well documented. It has always been up to you, the individual developer, to uncover them on your own through painful trial and error.

Frustrated by this, I set out to discover the Node.js philosophy and what people really mean when they talk about "The Node Way." Is it just about small modules and asynchronous code, or could there be something more?

http://thenodeway.io is the result of that journey. It is a collection of articles and chapters on understanding the fundamentals of Node.js and leveraging that understanding to build great things.

Fred K. Schott

December 30, 2014
Tweet

More Decks by Fred K. Schott

Other Decks in Technology

Transcript

  1. “Once you get into the ‘Node Way’ of building lots

    of small, single-purpose modules, you want to start doing it all the time.” — NPM blog post http://blog.npmjs.org/post/ 100099402720/registry-roadmap
  2. “… The Node Way, handed down from the ancient times

    of Node 0.3.” — NPM FAQ https://docs.npmjs.com/misc/faq#- node_modules-is-the-name-of-my-deity-s-arch- rival-and-a-forbidden-word-in-my-religion-can-i- configure-npm-to-use-a-different-folder-
  3. (example) return early //  Bad!   function  isPercentage(val)  {  

    if  (val  >=  0)  {          if  (val  <  100)  {              return  true;          }  else  {              return  false;          }      }  else  {          return  false;      }   } — Example by Felix Geisendörfer //  Great!   function  isPercentage(val)  {      if  (val  <  0)  {          return  false;      }      if  (val  >  100)  {          return  false;      }      return  true;   }  
  4. (example) get help with control flow async.series([      

       function  callFirst(){  ...  },          function  callSecond(){  ...  }   ]);     async.parallel([          function  callTogether(){  ...  },          function  callTogether(){  ...  }   ],  callback);  
  5. If you’re thinking it, someone has already thought it, named

    it, built it, and maybe even written tests for it.