The CoffeeScript Dilemma
I do dig JS now, and there’s tons of little helpers you can use to make it fit whatever workflow you choose. I’m really digging on both Dojo and Google Closure now. There’s tons of stuff out there.
Meanwhile for other small projects and various snippets on your web page, JS will be in full effect.
The Implementation Phase
I think we’re starting to see this answer in the form of a dilemma in regards to CoffeeScript.
I Don’t Really Like CoffeeScript
There I said it! It’s probably no surprise to those that know me that I don’t really care for it. But I did go ahead and learn a little about it, and why someone would use it. The best pro-CoffeeScript argument was this 44 minute video from 37Signals Sam Stephenson called “Better JS Through CoffeeScript”.
The arguments presented in the video were largely “Look at how sexy this code is”, ”You save so much typing”, etc etc. The underlying argument was that it’s more readable.
Well, it’s not….to me anyway – it was pretty hard to read, even as Sam was explaining it. I can definitely see if you have a Ruby background that it IS much more readable. From my perspective we’re bringing JS into the Ruby comfort zone. I think, for me personally, Google’s Dart would bring JS more into MY comfort zone.
Anyway, just keep that in mind. There is no “best” language in the world. There’s just the best language for you and/or your job. And that’s totally cool.
One VERY compelling reason for CoffeeScript, on the other hand, was the whole compilation thing. Think about jQuery. If you do a jQuery “each” method, you’re using the underlying framework to do something for you. It adds computational overhead.
Contrast this with CoffeeScript – it will write better code out for you, and that’s what your browser will be running. So that’s a great thing in my mind – no framework overhead, and you get to write things that are easier for you to read and understand as a developer.
But, again, to each his own. Maybe someday I’ll get around to using Coffeescript and it will be another acquired taste.
I cracked open Twitter before lunch today and I see a comment thread on an Ember.js related blog post:
The blog post itself was independently written (important for this conversation), and contained some how-tos for using the Ember.js framework,.
Unfortunately for me and @commadelimited (Andy Matthews), the examples were written in CoffeeScript, so they were pretty hard to read (for me anway).
This might be where you expect me to rail on the author for using CoffeeScript….but no, that would be silly. This was written by a blogger in his spare time – we should be supporting him and appreciative regardless of if he wrote the example in Objective J.
On the other hand, it really throws off my game! Part of me goes all American Redneck complaining why I have to press #1 on my phone for English.
Did we have these problems before? Usually, in my experience, we started at the language, and built frameworks on top of those languages). Now anything goes! And we need to mix and match.
I guess the best advice would be for me personally to learn CoffeeScript even though I don’t plan to do things with it. It’s a hard pill to swallow because learning has always equaled productivity for me. Now, it’s learning for the sake of understanding our foreign language friends, who have something important to say.