a blog for those who code

Thursday 17 July 2014

Nodejs : Preferred Node Style

Some of the recommended usage of styles in Nodejs which I felt to share are as follows. Note there is no official document about the same, the shared styles might not be fit for your application.

In my opinion this set of styles will be useful to build beautiful and consistent software and it will be easy for the fellow developer to understand.

  • Use asynchronous functions over synchronous.
  • Use Semicolons.
  • Use single quotes instead of double quotes.
  • Declare one variable per var statement.
  • Constants should be uppercase.
  • Variables should be camel cased and it should be in lower case.
  • Use of '===' (triple equality operator) instead of '==' (double equality operator.)
  • Always use return statements in a function.
  • Named closure instead of Unnamed closure.

These all are the styles which I liked to share and its upto you to follow or not :). But the important one is to use Asynchronous functions over synchronous functions as it makes your Nodejs application way too faster.

If you have any other styles which you like to share, please do comment.

Please Like and Share the Blog, if you find it interesting and helpful.

No comments:

Post a Comment