Testing express

Testing express

Saturday, May 19, 2012

Adding power to browsers - node.js

As a tester I need to keep myself updated with the latest technologies and tools, So I thought of putting down my learning experiences here

There is a new technology in the javascript land called "node.js", it is being used in one of our projects. This gave me some motivation to explore it.

I was thinking, where does node.js fit in the knowledge/information I have? I started with browser as a starting point. The main basic elements of a browser are HTML, JavaScript & CSS. I will be referring JavaScipt as js, because I may need to use it often. 
what problem does js solve?
Html can serve only static webpages, js can serve dynamic webpages.
I tried to find out more information about js:

1) js is an interpreted language with object-oriented capabilities 
2) js runs in a single threaded environment, meaning multiple scripts cannot run at the same time 
3) Each of the popular browsers use different js engines
IE – Chakra
FF – SpiderMonkey(built in C++), Rhino(built in Java)
Safari – Nitro
Chrome – V8

What is node.js?
"node is a bunch of sugar on top of virtual machine v8" --Quote from Ryan Dhal, creator of node.js

It means node is a tool built on top of google's js engine v8, this is the same engine which chrome browser uses.

What problem does node.js solve?
js has concurrency issues, it is not possible to do several things at same time, node addresses this concurrency problem. you can run multiple scripts at same time. It means response times are fast.

Eventhough node solves this problem, it has some limitations
its still young and immature, you can listen to this video to know more about node from the creator ryan dhal http://www.youtube.com/watch?v=jo_B4LTHi3I

Important points
  • generally js is executed in browsers, with node you can execute js from outside a browser
  • node has a command line tool/console, similar to irb in ruby
  • you can execute javascript file from the command line tool/console using node command
For testers this can be a important tool in the toolkit for learning & exploring js, which is an important element of a browser.

No comments:

Post a Comment