I found chapters 2, 3, and 4 to be the most immediately useful sections in the book. Classes are discussed in chapter two – creating them revolves entirely around the “class” keyword, which is logical enough. You can create instances of the class with the “new” keyword, and both static properties and instance properties can be included in a given CoffeeScript class. There is also an “extends” keyword for inheritance, and an easy way to create a constructor method.
Chapter 3 starts with the CoffeeScript versions of ECMAScript 5 additions. The “each” function is more efficient than the ES5 equivalents, “forEach” and “map”, due to the way the CoffeeScript code is compiled into JS. Some time is also spent describing the “natural language” style of logical comparisons, using “and”, “or”, and “is” instead of “&&”, “||”, and “==”.
Chapter 4 is really cool, and answers a lot of practical questions about implementation. Cake is discussed as a way to compile CoffeeScript; later, the author outlines using Node (server-side JS) to compile the CoffeeScript when the page is requested. Templating systems are also discussed in this chapter, and it’s fascinating stuff. The chapter ends with a brief explanation of setting up a Node server on Heroku’s Cedar stack.
Overall, I’m very glad I read this book. I’ve read some great tech reference books, and I’ve read some awful ones – this book is definitely one of the better ones.
I should disclose that I received a free e-book copy of this reference book from O’Reilly, in exchange for a review. I participate in the O’Reilly Blogger Review Program.
You can find this book in the O’Reilly Online Catalog at: http://shop.oreilly.com/product/0636920024309.do