Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
There you have it. We have used jQuery to write an interactive web client for our todo list application. It was pretty simple, and you can see how CoffeeScript can help us write some very nice looking jQuery.
The approach we took in this chapter, from a code “architecture” perspective, is that of what a lot of jQuery developers probably would have done. Write a bunch of functions, pass around some objects, and do what is necessary. We could have taken another approach to this application, which would have involved writing classes that managed each of the todos and more cleanly wrapped the HTML elements and their events to the todo itself.
So why didn’t I show you the second approach? I did this for two reasons. The first I have already stated; the approach we have shown here is one that is common of someone writing plain old JavaScript and jQuery, so I wanted to give you a feel for what that would look like in CoffeeScript. The second reason I didn’t write our code in the “class” style is because doing so would mean we would have reinvented the wheel that is Backbone.js.