Dropbox Rewrote Its Entire Browser-Side Codebase In 1 Week

The engineering team at Dropbox re-wrote its browser-side codebase one week last July, according to a post on the Dropbox tech blog. The rewrite was done to translate all of its JavaScript into a language called CoffeeScript.

CoffeeScript is a language that compiles into JavaScript. It offers an alternative syntax that looks more like Python or Ruby, with the goal of enabling “literate programming”, an approach to writing code that’s meant to be more human readable.

The language has generated considerable controversy in the JavaScript community, but has many supporters, including JavaScript creator Brendan Eich. Eich spoke highly of CoffeeScript at JSConf 2011, which he co-keynoted with CoffeeScript creator Jeremy Ashkenas. Eich has been working to bring some of the syntax of CoffeeScript into the next version of JavaScript, codenamed JSNext, and encourages developers to create their own JavaScript variants as a way to potentially improve JavaScript.

The Dropbox blog post addresses some of the common complaints about CoffeeScript, including performance and debugging. According to the blog post: “The size of the compressed bundle didn’t change significantly pre- and post-coffee transformation, so our users shouldn’t notice anything different. The site performs and behaves as before.” They also conducted extensive testing of the code changes during the week to make sure nothing broke.

The team used js2coffee, an automatic conversion tool, to speed up the process.

Here’s a before and after example from Dropbox: