Build Better Web and Mobile Apps Using Node.js

Posted by in Mobile and Tablet, Web Development tagged with ,

Node.js logo with image of someone riding a white swan in a lake

When I first heard about Node.js, I may well have scoffed. I don’t tend to scoff a lot, but using JavaScript to run a server engine seemed a bit like circumnavigating the globe in a swan-shaped paddle boat.

Don’t get me wrong, I love JavaScript. I also love giant swan boats, but I know that they don’t travel well, and they don’t do well in high seas. At any rate, JavaScript is often the right tool for the right job when it comes to creating dynamic front-end interfaces when you don’t need a lot of power, like say on a mobile device. But running a server using Javascript seemed a grossly underpowered swan boat for this particular ocean. So I dug deeper and what I found was badass.

If you haven’t heard of Node, you’re not alone. Still in its infancy, Node is an input/output (I/O) engine written to implement server operations very rapidly using a methodology usually reserved for client-side code. Wait, what does that mean?

It’s all about events

Back when I started developing in Flash, the highest hurdle I had to overcome was the event-driven nature of the language. Flash is built to respond to events. The user clicks, a connection is made, an image finishes downloading, and so on. These are all events that can be listened for and reacted to. A more traditional language would execute statements in order until the program was complete, but this style caused the program flow to be asynchronous, which is to say, you never knew when things were going to happen. Fundamentally, this was a different style of programming than I was used to. This is also how Node works. It sits quietly waiting, using very little resources, until an event occurs.

People love bullet lists, so here are a handful of awesome things about Node:

  • It’s built on top of Google’s incredibly fast V8 JavaScript engine. Since V8 compiles its code to run directly on the chip, this makes it lightning fast.
  • It doesn’t have all the overhead of a regular server. It’s just an I/O engine, and while it could be used to make a webserver, it has a much smaller footprint.
  • Without getting too technical, each Node program is like an island (thus the name Node). The way Node programs have to communicate forces the programmer to build programs that are ready to scale.
  • Most web developers already know the language for Node, JavaScript.

What to build?

Once a developer knows about it, their first question usually is “This is awesome, but what would I build?” The answer is: anything. Loads of components are already built to act as webservers, access services like databases, and facilitate routing a la Ruby on Rails. There are, however, certain tasks Node would be very good at. It would work brilliantly if your program needs to response to events immediately, such as in situations like the following:

  • Mobile apps that need dynamic navigation
  • Games and interactive e-learning
  • Integrating cloud services (think Cloud HQ, for instance)

If you want to find out more about node.js, check out this introductory video from the guy who invented it:


There’s always a moral

And this story is no exception: be careful what you scoff at. It may be the next big thing. Then you’ll be the jerk that scoffed at it. And you won’t get to ride in the swan boat.

We are just getting started with node.js. Stay tuned for more info on installing and configuring this little wonder. If you’ve used it and have any tips, let us know!

Mightybytes is a full-service creative firm for conscious companies and a certified B Corporation. Connect with us on Twitter, Facebook and Pinterest or fill out our contact form.