How I start using Node.js
In this post I would like to share with you my experience of start using Node.js.
I started my programmers career at almost 20 years ago and my first programming language was Pascal. After that I learn C and later on C++, and finally, I learn Java. I use Java since 1998 as my main programming language in almost every project that I worked on (essentially on the server side).
The Node.js was created by Ryan Dahl on 2009 and since JavaScript’s rising popularity as technology for building server side applications, the Node.js usage increase substantially.
Currently, I am developing the ARQUO platform, an SaaS platform for document and business process management that helps Enterprises and BPOs quickly and efficiently buy, sell and execute processes or services that span organisation boundaries. The main ARQUO component is the RESTful API, which it was initially built using Java.
After some study of Node.js, we think that the Node.js model and characteristics could help us to simplify and increase development speed.
We built a simple service (API) as a proof of concept and we figure out the following aspects:
- Fast, simple and easy to develop a service. Node.js simplifies the asynchronous programming and with Node.js it is possible to build complex applications that can scale easily. The single-thread model avoids writing complex multithreaded code with resource locking.
- Open source community that allows sharing information, libraries and source code, as well as platform extensions. Beyond that, it seems that everyone has a Node.js SDK (Stormpath, ElasticSearch, AWS, Stripe, among others).
- Data handling is very simple, since JSON is a standard de facto for RESTful APIs and Node.js has good support for JSON.
- The Node.js documentation is rather good with lots of examples, tutorials and manuals. The open source community helps a lot to share knowledge and experiences. And it is always good, to study the source code of others and with that study learn how the things can be done.
With Node.js is possible to create an application with very few code lines.
But, it is necessary be aware of the Node.js main ideia (single thread event loop) when we are implementing our application, because not all scenarios can be implemented in Node.js. Namely, applications that has intensive computation tasks are not adequate for being implemented in Node.js.
The proof of concept was a success and we decided to re-write the ARQUO’s RESTful API in JavaScript using Node.js.
This task was relatively fast, considering the functionality that was necessary to implement, and the final result was a service lighter, faster and simple to extend, maintain and modify. The number of source code lines for implementing the same functionality is lower than in other languages.
In conclusion, in ARQUO, the change for JavaScript and Node.js was good decision, although the Node.js is not the solution for all the problems. The Node.js is specially adapted for solving the majority of the problems and needs of the web and mobile applications, as well as the RESTful APIs.
Nice article António. A few days ago I used node.js because of Cordova, to port web apps to mobile devices.
Ouvi falar de Node em 2012! Parabéns António Sargento