Unit testing with JavaScript and NodeJS

In my latest project I needed a way to execute JavaScript from the command line. I knew a little about the Rhino project which achieves this and of course the Google V8 Project.

I experimented a little with V8 and the default shell sample application that it ships with. I found it easy to introduce native functionality using C++ and this seemed to perform well. I then discovered the nodejs project. nodejs is built on top of V8 and includes lots of general purpose functionality which is great for running JavaScript from the command line and fantastic for developing server applications.

Instead of reinventing the wheel with my custom V8 shell I decided to use nodejs. nodejs has an excellent module system which makes it easy to add new functionality.

Continue reading

Advertisements

Building server and client applications using JavaScript

JavaScript has become an essential tool that allows web developers to produce sophisticated web applications that often use AJAX to communicate with the server. JavaScript source code is becoming increasingly more complex and so it has become necessary for web browser developers to increase the performance of their JavaScript virtual machines.

Google Chrome features the v8 JavaScript environment which provides outstanding performance by compiling JavaScript into machine code (as opposed to being processed by a virtual machine). The performance boost is massive. V8 is released under an open-source license (http://code.google.com/p/v8/) which can be compiled and used as a standalone JavaScript processor, or more interestingly integrated into custom applications!

Continue reading