1991-2016—25 years of Art & Logic

Fun with CoffeeScript and Backbone.js : Part 3

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 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.

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.




Latest posts by rmb177 (see all)

Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.