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 Tom
Tom Hughes-Croucher is an Evangelist and Senior Developer in Yahoo's Open Strategy Group, focusing on Yahoo¹s Web Services and Cloud Platform.
Tom joined Yahoo! to work on the Yahoo! frontpage in Europe as a Front end engineer. He brought his experience from contributing to a number of Web standards for the World Wide Web Consortium (W3C) and the British Standards Institute (BSI).
Before joining Yahoo! he helped build the online music stores for some of the UK's largest brands including Tesco, Three Telecom and Channel 4.












Leave a comment