blog

Fun with CoffeeScript and Backbone.js : Part 3

by

Part 1 of this series can be read here.
Part 2 of this series can be read here.
The project is a simplified morse code simulator that animates morse code being sent over a telegraph line. The complete source is available here and the running code can be seen here.
In this post I’ll discuss my thoughts on CoffeeScript and Backbone.js.
JavaScript has slowly become my favorite programming language as I’ve done more web development. As you learn its Good Parts, you start to realize how powerful of a language it is. I’ll never forget the Aha! moment I had when I wrote my first closure.
Coffeescript logoCoffeeScript takes a great language and makes it even better. It hides the bad parts of JavaScript and adds the expressiveness of Ruby and Python. The addition of classes shields the developer from JavaScript’s prototypal inheritance and is much easier to understand for developers used to class-based inheritance. Admittedly, this was a small demo, but tracking runtime errors in the JavaScript code back to the CoffeeScript code was trivial. I definitely plan to use CoffeeScript as much as possible in future projects.
Backbone js
This demo only scratched the surface of Backbone.js. Views can be initialized with templates, making complex models easier to render. Backbone.js also provides functionality to automatically synch your objects to/from a server, provides support for collections and also provides routing functionality to ensure the back button works in single-page applications. I’m very interested in learning more about Backbone.js and using it to reduce the amount of front-end code I need to write.
In general, I think the combination of CoffeeScript and Backbone.js results in a much cleaner application. View code is segregated from the model code and developers are forced into keeping things more modular. This style would also make unit testing easier. I’m anxious to continue experimenting with both of these technologies to see how they boost my productivity and allow me to develop larger web-apps in a more controlled manner.

+ more

Accurate Timing

Accurate Timing

In many tasks we need to do something at given intervals of time. The most obvious ways may not give you the best results. Time? Meh. The most basic tasks that don't have what you might call CPU-scale time requirements can be handled with the usual language and...

read more