In the last 5 years, Node.js is a name that is mentioned so many times in the web developer community. Immediately after being introduced by Ryan Dahl in 2009, Node.js became a new trend of the programming world.
People are still arguing very intensely about its performance, but today we are going to talk about 5 interesting things that you can do when you get started with Node.js in a view of a crazy fan of programming languages.
Table of Contents
- Read more: Node.js Web Development
2. Asynchronous programming – Why not?
With other technologies, we may be familiar with the concept of asynchronous or non-blocking tasks. When we want to process a bunch of data that takes time (such as getting data from the server or querying the database) and expect the UI will not be blocked, we use some libraries to do this kind of task on a background thread.
With Node.js, the asynchrony engrains the way we write the lines of code. Functions that receives parameters processes them and then returns something sequentially may become too obsolete with you if you are a Node.js developer. Now, we have to always think about putting a function as a parameter into another, and then call it when all things are done in the second functions.
- Read more: offshoring software development pros cons
Furthermore, if you want to deal with Node.js, you have to deal with the way we use a shared variable just like what we have learnt about mutex and semaphore in Operating Systems. A beginner may get stuck at some tragedy situations such as Callback Hell or wrong index variable in a loop which contains an asynchronous task. Don’t worry. If you find a way to resolve these kinds of problems yourself, you will realize that working with Node.js is full of fun.
Synchronous vs Asynchronous
3. JSON is not just formatted text
4. The power of NPM
NPM is a packet manager for Node.js. It’s something like RubyGems of Rails, Composer of PHP, Pod of iOS or Maven Central of Android and Java. But it’s not so simple. The point is, nowadays, front-end web developers also use npm for their projects. Packets of NPM are small, simple but very helpful for any web development, especially these two libraries for automatic tasks: gulp and grunt. Another important library is bower – a packet manager for front-end web development, which is installed by using npm.
5. Electron – The future and more
- Read more: Node.js Framework
Although just recently launched, it is showing a superior strength because some very well-known applications such as Visual Studio Code and Slack used it even before it becomes widely available for developers. And the reason for its appearance in this post is that the Electron uses Node.js. I believe that it takes not so much of our time to export a desktop application from our web apps that are written with Node.js.
Apps using Electron