Node.js Notes

As I'm going through the process of learning Node.js I figured I'd document my findings here. Most of this information will be taken from the resources I list below. This will be an ongoing post, so check back to see if anything new has been added.

Notes:

  • Created by Ryan Dahl
  • No Sleep in your code. You can't do it. You shouldn't do it. At no point should your code be in a locked state.
  • Node will Send HTML or Responses to the client as its ready. So you're not wasting server memory build an output that you'll later send.
  • Node is built on Google's V8 JavaScript Engine.
  • No Blockers - It can handle many things at once.
Issues with Node:
  • Immaturity - Still very new - Built from scratch
    • Not built on Python, Ruby, or Java
    • So if there is no driver to connect to Oracle, you have to write it yourself. Or go and find it online, probably written by someone as a hobby.
  • Event Loops
    • You're always killing your stack. So if something fails, good luck trying to debug it. To throw an error try: 'throw new Error("Oops!");
  • Single Threaded System
    • There is a kernel schedule to apply processes to other threads.
    • This isn't an issue because at a large scale, apps need broken out into modules. And they need to speak to each other via connection protocol. So forcing that to happen, even at a single box level (threads) enforces that mindset to be used.
Resources: Tutorials: