Web Directions Reflections, part 1: JavaScript Evolution and the Aussie Invasion

    Craig Buckler

    I was fortunate to attend Web Directions @media in a slightly gloomy London last month. The event was a magnet for all the movers and shakers in the web world and both days were packed with excellent sessions for developers and designers.

    Where do I start? It was impossible to attend everything, but I hope this series of posts gives you a flavor of the event and contains a few interesting snippets of information.

    The Aussies Invade

    I bet Melbourne’s empty: most of the population are in the UK working at Walkabout pubs or running web conferences! But congratulations to Maxine Sherrin and John Allsopp for organizing Web Directions @media. Everything ran smoothly … with the exception of the usual wi-fi woes when 200 people attempt simultaneous tweeting.

    Brendan Eich: Grown-up JavaScript

    Brendan Eich
    Think you know JavaScript? Meet Brendan Eich!

    Brendan is Mozilla Corp’s CTO and inventor of JavaScript, the world’s most widely-used programming language and the basis of many web careers. Brendan crammed a lot into his hour’s keynote. Possibly too much — just as you thought “wow, that’s cool”, he was on to the next point.

    JavaScript, or Mocha as it was originally named, was born in May 1995. It was designed to be easy, or certainly easier than writing and compiling Java applets every time you needed a roll-over effect. For Brendan, the best parts are first-class functions, closures and prototypal inheritance. He apologized for eval, the global object and the with statement!

    Brendan revealed several features coming in the ECMAScript 5th Edition and Harmony which is scheduled to arrive in 2013. The most notable features … well, those I was able to scribble down…

    let — a better ‘var’

    The new let declaration defines block-scoped variables. For example:

    let x = 99;
    if (true) {
    	let x = 1;
    	alert(x); // output 1
    alert(x); // output 99

    Powerful stuff, although it will certainly lead to some debugging nightmares!

    Enhanced function parameters

    JavaScript will support default parameters like PHP and C# 4.0, e.g.

    function add(x = 1, y = 2) {
    	return x + y;
    alert( add() ); // output 3

    It will also be possible to define optional arguments using the slightly bizarre ‘…args’ syntax. The function will have access to a real array named args[] rather than the normal JavaScript arguments object which looks like an array but isn’t!

    A shorter function

    Are you fed up typing ‘function’? Should it be shortened? Brendan thinks so and suggested several options. That deserves it’s own post and a SitePoint poll tomorrow…

    Speed tests and IE9

    Brendan revealed arewefastyet.com will provide JavaScript speed tests which use real-world activity scenarios rather than standard benchmarks. It’s primarily used to assess the speed of Firefox’s JavaScript engine and it currently displays “No”.

    Finally, he asked us to beg and plead with Microsoft to produce a version of IE9 for Windows XP. If you think IE6 is bad now, imagine what it’ll be like having to support IE8 in 2015.

    Tom Hughes-Croucher: An Introduction to Server-Side JavaScript

    Brendan Eich
    Yes, Tom is this blurred in real life!

    Tom provided an amusing and insightful talk featuring narwhal-riding unicorns. He was so confident about the awesomeness of SSJS, he used Comic Sans throughout the whole presentation! I managed to write a few notes despite my bleeding eyes…

    JavaScript is the universal language of the web. Unfortunately, many of us have to split our time between JavaScript and server-side languages such as PHP, C# or Java. Tom is convinced it doesn’t need to be that way; we can all become better developers if we immerse ourselves in a single language.

    The advantages of Server-Side JavaScript include:

    • there’s no syntactical split
    • progressive enhancement is “free” — the same form validation code will work on both the server and the client
    • JavaScript is becoming increasingly popular: it’s regarded as a first-class job and runtimes such as Rhino, SpiderMonkey and V8 are improving rapidly.

    Tom reserved most praise for Node.js: the super-fast web server with an event-driven I/O framework running on the V8 JavaScript engine. He demonstrated how easy it was to convert a YUI3 calendar component to run server-side. Very impressive.

    Tom’s SSJS slides are available online and you can also read his SitePoint interview.

    Coming in the next Web Directions Reflections post: John Resig and Jonathan Stark on mobile web development…