Saturday 16 February 2013

Node.js - Tutorial - Part 1


Hello folks. This one is going to be a post about Node.js. Am an absolute beginner at this front . This post is just sharing my experiences about what I learnt and will keep updating when i learn new stuff.

The best way to start learning something new in my opinion would be to read an article with some examples given. Work out the same stuff and start experimenting and eventually take up small projects and get even more proficient in the language or the framework. This is me striding in that journey!

Question 1 : What is node.js? Let me google and find stuff about it.

Explanation from the official site :

" Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. "

Lets break it down a bit.
Its built on Chrome's JS runtime(Whtever!).
Its event driven, non blocking I/O model - Wow that's new. What does that mean. I googled a bit more and found out rather interesting stuff about it. Link provides an interesting benchmark result between Node.js and Php. Essentially Node.js is event driven asynchronous in that Server  adds and event to the queue and sends a callback with it and keeps working on other stuff. There is only one thread serving any number of requests from any number of users. The rest of the tasks( the events queued) are accomplished by  threads from a thread pool maintained by node.js. Its like a manager redirecting tasks to N people at his disposal and keep serving thousands of request. The idea is based on the observation that a fair amount of time in server is wasted on serving up I/O requests. As stated in the explanation from the official site its light weight and scalable. Benchmarks in the link  provided proves the same.

Essentially to sum it up : " Its a platform where server side code can be written using Javascript(Wow!) . Its fast and scalable for RT apps. And hopefully its fairly easy to learn!"

Q2 : Ok I got the initial info needed. Now I need to get my hands dirty to try out some stuff.

This is a crucial step. Quite a few steps are involved in this step. Environment setup, knowing the rules of the game and other stuff.

I believe a decent intro to any new language or framework in Web atleast needs the following

  •     To be able to write a Hello World in it. ( Yea right ! Stop kiddin me U say ! )
  •     To be able to post a message from one page to another. (Server side specifics)
  •     To be able to interact with DB to store and retrieve stuff. ( Server side specific)
  •     And to create a simple yet decent app with it.

We will continue the journey in Part 2. 

No comments:

Post a Comment