Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Node.js and JavaScript Coding and Development Guides

DZone's Guide to

Node.js and JavaScript Coding and Development Guides

· Web Dev Zone
Free Resource

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

Every now and then I go back to do something with Node.js, and when this happens I’ve already forgotten everything I did and all the little knowledge I acquired the previous time I used it, and I always have to start almost from the beginning again.

Two years ago I wrote about how to get started with Node.js. I think most of the information there is still valid … even the book Node.js in Action is still in MEAP (this time planned for release this month, August 2013).

This summer I’m planning on revising, during my holidays, the architecture of OpenROV, and given the huge number of people that are starting to use it, I want to inject a bit more of “better ALM” into the mix, so I started to look around for coding conventions, development guidelines and how to do unit testing, continuous integration, build and so on. This post is a collection of some links that I found useful.

Coding and Development Guidelines

Here are some of the links I found useful.

One common idea that comes out from those pages is:

All code, in any code-base, should look like a single person typed it, no matter how many people contributed.

So, when starting a project--either open source or proprietary--write a style guide, possibly striving for maximum readability--especially if it’s open source--and make sure every contributor agrees and then follows it.

Testing Framework

A testing library I’m looking into experimenting with is Jasmine (or actually the Node.js version, jasmine-node). Jasmine is a BDD framework, the syntax looks pretty intuitive and, if text descriptions are carefully chosen, the report is very human-readable and describes very well what each test is doing.

The documentation for Jasmine is well done, with samples of every aspect of the framework, and the wiki also explains how to use Jasmine with other frameworks. If you want to do some tests you can also try it directly online at http://tryjasmine.com/.

Other JavaScript testing frameworks include Mocha and QUnit, the frameworks used to test jQuery, jQueryUI and jQuery Mobile. To use this last one with Node.js you need to use its port on Node.js: node-qunit.

And while not strictly a testing framework, and also not needed with Node.js, Karma is a test runner for JavaScript, useful because your application probably has some JavaScript that runs in the browser and integrates with the DOM.

CI and build

One service I’ve tried a few times, mainly for testing purposes, is Travis CI. It automatically pulls changes from GitHub and can build projects on most platforms (except .NET). To configure it, all you need is to add a .travis.yaml file on your repository.

OpenROV is already being built on Travis-CI, but at the moment it only installs all the needed packages, so it's not very useful. But, once I add some tests, I think it will become more interesting to use.

I’ve also noticed that Travis-CI picks up every pull request and runs the same set of tests, thus immediately verifying whether the pull request broke something or not.

Deployment

I usually deploy to Azure Websites, which can run Node.js without a problem. I gave a speech at the local Node.js user group about how to deploy a MongoDB-powered Node.js app on Windows Azure.

Conclusion

Let’s now see if I can find the time to really build a prototype of the new structure of the OpenROV brain.

Do you have more links you think are useful that you want to share? Please write a comment and I’ll add them to the post.



Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

Topics:

Published at DZone with permission of Simone Chiaretta, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}