Don't write spaghetti code in server side JavaScript

A session at JSConf EU 2010

Sunday 26th September, 2010

12:45pm to 1:15pm (CET)

Sever Side JavaScript (especially Node.js) is a hot topic right now, but we are still figuring out what good SSJS code looks like. It isn't enough that we can write JavaScript on the server, or even that it is well written JavaScript. It's essential that we write maintainable JavaScript for the server environment. This talk will examine different coding styles for event driven, non-blocking SSJS and which styles are most successful.

We'll take a look at strategies that other languages and frameworks with similar attributes such as Clojure, Erlang, Python/Twisted and Ruby/Event Machine use. From these languages we'll take a look what has worked well and what hasn't. We'll explore how these models can apply to JavaScript to create patterns that can be used to make code more maintainable.

Since JavaScript is already an event driven language there is already a lot of support for events, and developers are used to developing code with the event driven browser. However, how we use these features on the server with it's additional freedom can either help or harm the long term use of our code. One of the obvious code defects created by poor use of the evented model in JavaScript is Pyramids. Pyramids are huge chains of nested, dependant anonymous callbacks piled one on top of another until you end up with a pyramid of code, left to right. Pyramids are one of the first, obvious, mistakes people tend to make when beginning SSJS. We'll also discuss some of the less obvious ones and explore ways of avoiding them.

About the speaker

This person is speaking at this event.
Tom Hughes-Croucher

I make things reliable at Uber

Coverage of this session

Sign in to add slides, notes or videos to this session

JSConf EU 2010

Germany Germany, Berlin

25th26th September 2010

Tell your friends!


Time 12:45pm1:15pm CET

Date Sun 26th September 2010

Short URL


Official event site


View the schedule



Books by speaker

  • Node: Up and Running

See something wrong?

Report an issue with this session