Book Review: CoffeeScript Programming with jQuery, Rails, and Node.js

Post to Twitter

Today I’m going to review the ebook version of CoffeeScript Programming with jQuery, Rails, and Node.js authored by Michael Erasmus and published my Packtpub.

CoffeeScript Programming with jQuery, Rails, and Node.js Book

The eBook I read was approx. 125 pages and broken up into five chapters. I’ll go through each chapter individually.

Chapter 1: Why CoffeeScript

If your new to CoffeeScript but have a little JavaScript experience then this chapter will quickly show you how to grasp CoffeeScript easily. One great benefit is showing the CoffeeScript syntax and then the corresponding JavaScript syntax. It shows how they differ but also how much more easy CoffeeScript can be to read as well as less to type.

This chapter also covers CoffeeScript’s destructuring assignment, list comprehensions, classes, string interpolation, array slicing, splats and ranges. Its a great introduction to CoffeeScript and should whet the reader’s appetite to continue forward.

Chapter 2: Running CoffeeScript

The first part of this chapter briefly covers some interesting CoffeeScript history (did you know it’s early compiler was originally written in Ruby?). The author then moves onto installing CoffeeScript on all the major operating systems like Linux, OS X and Windows. Once CoffeeScript is installed the basics of using the coffee command are covered as well as how to get interactive using Read Eval Print Loop (REPL). After a few more paragraphs of the basics you move right into compiling your first CoffeeScript file to JavaScript.

Chapter 3: CoffeeScript and JQuery

For some reason I don’t believe a lot of people think you can use CoffeeScript with jQuery. Since CoffeeScript is JavaScript there is no reason not to do so. A very quick introduction to jQuery is done on the first few pages of the chapter. From there the author goes into putting the reader’s knowledge to work by building out a Todo application using CoffeeScript and jQuery. I thought it was pretty cool that the author used HTML5’s local storage to store the Todos. At the end of the chapter the author assigns the reader a task to make the Todo application’s clear completed button work. I wish this had been backed up though with sample code at the end of the book on how to do so for the readers that might get stuck on this. I expect most readers though probably won’t have too much trouble. This task is continued through the remaining chapters with Rails and Noce.js.

Chapter 4: CoffeeScript and Rails

A decent introduction to Rails is done along with the then controversial move Rails did in version 3.1 where CoffeeScript became the default for writing client-side JavaScript code. The author then shows you how to get Rails up and running and then moves onto a sample application which in this case is another Todo application but this time using a server rather than the prior example of just running in your browser locally. The application in this chapter is a little more complex than the previous chapter but you should be able to follow along easily even if your not very familiar with Ruby or Rails. A I mentioned above this chapter also ends with a task to make the Todo application’s clear completed button work.

Chapter 5: CoffeeScript and Node.js

I feel this chapter’s contents is probably what will interest most readers. CoffeeScript has been a hit in the Node.js community. Yes, it has it’s detractors but it has a lot of support and I’ve seen a lot of Node.js projects that are written with CoffeeScript. A quick introduction to Node.js is done and a Hello World application is built in CoffeeScript to start off with. From there you move onto the Todo application using Node.js, Express, Jade, Socket.io (WebSockets), and Connect. I think the author did a great job here using the libraries/framework he chose. Using Socket.io really can show a person new to Node.js just how easy WebSockets are to use in Node.js. The WebSockets are used to collaborate with other users in the Todo application. The Node.js project is setup correctly and shows a great example of how to do it “right”.

I think a great bonus to chapter five would’ve been to quickly shown the reader how to do some basic unit tests on the code (using CoffeeScript of course). Its not essential to a CoffeeScript book but I think it would’ve been a nice touch.

Conclusion

Overall this is a great book, well priced, and worth picking up if your looking into increasing your productivity using CoffeeScript. Its a great introduction and puts your knowledge right into practice with the Todo application.

Post to Twitter

This entry was posted in CoffeeScript, JavaScript, Node.js, Open Source, Rails, Reviews. Bookmark the permalink.