Learning CoffeeScript (no, for historical reasons)

The task on Pivotal Tracker (love using it) says "Learn CoffeeScript". The project this chore forms a part of is really important to me, and while several important projects I am working on still deserve to be based on Drupal, others deserve a new kind of architecture, something wildly new and at the same time something going back to my roots (learning C with Kernighan and Ritchie's The C Programming Language enthralled with the hiding of detail overload prevalent in the Z80 and 8086 assembler languages I had been using) in the eighties (Turbo C...).

After the road led from Assembler to C, I did a few years stint in the telephone industry with C++, then several more in various industries with Java (first Enterprise Java, then the refreshingly lightweight and modern Spring framework). When I was learning Java for the first time, I enjoyed using the online Java Tutorials almost as much as I had valued K&R. I enjoyed trying out the examples, gaining proficiency and confidence, learning through practice.

Then it was time to move Beyond Java, and for a while there I plunged into and enjoyed the economy and power of Ruby and Ruby on Rails. You can still see how much energy I put into my Instiki Wiki, still online. But it never really "took" with me in the "Real World".

Now I need a rock bottom architecture that can take me to the next level so I can responsibly face today's challenges. Could the new language that was so much a part of me when I was using C, now be Javascript? Yes, I have been, for about two years now, a firm disciple of that corollary of The Principle of Least Power which is Atwood's Law: "Any application that can be written in JavaScript, will eventually be written in JavaScript".

I recently wrote about the "holy grail of single language unified client/server web app development" in my article Getting started with Meteor and Derby on your own server. But as I tinkered with these new frameworks (me wanting to get back to something as modern and powerful as Spring/Java), I realized that a lot of the ease of use and joy of simplicity had to do with the most-favored use of CoffeeScript. Just as C tucked away assembler language detail overload, and exposed coding to productive idioms and patterns, CoffeeScript does with Javascript.

So I grabbed a copy of Programming in CoffeeScript and grabbed the code from the github repo, and discovered that CoffeeScript was not a crutch or syntactic sugar, but brings all the joy of languages like Ruby and one feels powerful again, without the distractions of Javascript (which is right there anyway if you need a detail overload fix to feel powerful in a mechanical way) as the language now exists. In short, without going into the gory details of the usual polemics (check out one of the most recent ones), if Javascript is the single language on the frontend and the backend cuz Atwood's Law, I feel CoffeeScript is the way the language will be not too far into the future (there are indications that thngs are headed that way: "Additionally, Brendan Eich has referenced CoffeeScript as an influence on his thoughts about the future of JavaScript." --http://en.wikipedia.org/wiki/CoffeeScript). So I feel learning and planning my current and future productivity on top of CoffeeScript to be an example of having my feet firmly placed in the river of history, just has it was with C, with Java, and briefly with Ruby, hopefully, for a longer time, with CoffeeScript, and later something like CoffeeScript: Javascript.

So I am currently working through the examples in Programming in CoffeeScript, and I see that the basic architecture of the obligatory ToDo app presented in the book (Backbone.js, Node.js, MongoDB...) might do me just fine and save me from the Meteors and Derbys of this world after all. Obviously more on this later!

There was one thing, though. Most of the joy of CoffeeScript is its emulation of the simplicity and pithiness of Ruby, Python, Pearl; but I don't want to program in those languages, or continue making them a big part of my development environment, I just wanna use Javascript where I can. So the chapter on testing involves Jasmine, and to use Jasmine easily with CoffeeScript you need to install it using Jasmine Headless Webkit (see Chapter 8), and that kind of involves using the Ruby package manager gem, which is cool but doesn't flow with the zen of the moment for me. So I opted in my search for a productive environment, for Mocha (using Chai as TDD/BDD assertion library), and found a very cool tutorial on that, and I get a beautiful BDD approach into the bargain!

Mocha: http://visionmedia.github.com/mocha/

Chai: http://chaijs.com/

Cool tutorial: http://net.tutsplus.com/tutorials/javascript-ajax/better-coffeescript-testing-with-mocha/