Cloud file hosting service Dropbox is now running in CoffeeScript over JavaScript, with Dropbox devs converting and debugging more than 23,000 lines of JavaScript into CoffeeScript during Hackweek.
According to the developers’ blog, the primary reason for the switch is because CoffeeScript takes out a lot of unnecessary coding syntax – more than 5000 lines of code were taken off from Dropbox after the conversion (23437 for JS against 18417 for CoffeeScript, respectively).
The developers used converter js2coffee for their mammoth rewriting task, mainly to avoid doing the dull-although-it’s-got-to-be-done conversion tasks.
“Considering the strange, difficult and rushed circumstances of its origin, JavaScript did many things well,” the blog states, “but is it any surprise that it got a bunch of things wrong too?”
Similarly, the Dropbox devs disagree with an argument from Ryan Florence concerning the deficiencies of CoffeeScript (to which Florence has since stated he’s a CoffeeScript convert).
Of particular interest, and where the Dropbox team disagrees, is the argument that while CoffeeScript may be faster to read, JavaScript may be faster to comprehend.
In total, 5020 lines of code were dropped, 9276 tokens were shaved off and 205863 characters were lost.
The team does admit, however, that regarding complexity of code, it’s not as easy to measure it in terms of throwing a few figures out there.
“Regardless, fewer lines is beneficial for simple reasons”, the team explains, citing fitting more code into a single editor screen as an example.
Not everyone’s satisfied, of course. The first comment on the blog reads: “You guys seriously have nothing better to do than rewrite software that already works?”
This is not an unfair criticism, especially if one considers that CoffeeScript compiles into JavaScript.
But what is the solution? Were the Dropbox developers right to move to CoffeeScript?