Skip to main content

Posts

Showing posts from April, 2014

Node.js best practices you should follow

Node.js is a platform built on Chrome’s JavaScript engine (i.e. v8 JavaScript Engine); it helps to develop fast, scalable network application. It is basically used in server side coding, handling AJAX requests, maintaining routes for different APIs and manipulating database. Node.js uses an event-driven, non blocking I/O model that makes it lightweight and efficient. Now without defining v8 the blog will remain incomplete.  v8  is Google’s open source JavaScript engine which is written in C++. Best feature of v8 is: it can run independently, or can be embedded into any C++ application. Let’s come to the main topic; here are the Node.js best practices: 1. Learn the best practices of JavaScript first: Before starting Node.js you should learn the best practices of JavaScript first. It will make your code more decent and flexible. There is a statement code lovers always use, “A fool can write codes which only machines can understand”. So, my suggestion is follow the guidelines to

JavaScript coding standards we follow

This document’s primary motivation is twofold: 1) code consistency 2) best practices. By  maintaining consistency in coding styles and conventions, we can ease the burden of legacy code maintenance, and mitigate risk of breakage in the future. By adhering to best practices, we ensure optimized page loading, performance and maintainable code. Therefore, at Innofied, we follow these guidelines strictly while programming. 1 . Proper File Naming Conventions a) Use Constructor function name as file names. So as per example, file name will be Hero.js For example: 1 2 3 function Hero ( ) {    this . occupation = ‘ Ninja ’ ; } b) Choose meaningful file names for your JavaScript files like the file names should be derived or chosen by focusing on what the file holds and use CamelCase for your file names. 2 . Indentation a) The unit of indentation is 4 spaces. b) Use of tabs should be avoided. c) Use “format” option of your IDE. 3 . Line Le