Programming in CoffeeScript

Author: Mark Bates
Publisher: Addison-Wesley
Pages: 320
ISBN: 978-0321820105
Audience: Intermediate to advanced JavaScript
Rating: 4.5
Reviewer: Ian Elliot

CoffeeScript is a better JavaScript and now is a good time to find out about it. 

Programmers complain about JavaScript, but if you use it correctly it isn't as bad as it seems. CoffeeScript isn't really a completely new language - it is more like some improved syntax added to JavaScript. This makes it fairly easy to compile CoffeeScript into JavaScript. It also makes it fairly easy to understand the generated JavaScript. This raises a problem for anyone trying to write a book on CoffeeScript. Do you treat it as a new language or do you present it alongside the JavaScript it generates and improves on?

In this particular book the author has taken the view that you need to know the JavaScript as well as the CoffeeScript. This isn't unreasonable, but for me the fact that I have to continually swap between CoffeeScript and JavaScript is the reason I gave up using it. Why take two languages into a web app when one will do?

The book is aimed at intermediate to advanced JavaScript programmers. Right at the start the author provides a little test to see if you understand a for loop. If you don't, then stop reading the book and go learn some JavaScript. Clearly CoffeeScript is not a first language to learn.

Banner

Part I of the book is an introduction to CoffeeScript with the emphasis on showing how it relates to the JavaScript it produces. Chapter 1 is about getting started - installation and all that - except that it isn't. The author makes the valid point that there is no way installation instructions can be kept up-to-date in a book and so directs the reader to the appropriate web page. This is true enough, but it raises a number of questions. For example, what point is there in providing a web link in a book as these die all too quickly? Also, if installation instructions are out-dated quickly, what about the rest of the book? Surely this is an argument for putting the entire book on the web? A more reasonable approach would be to give an outline of the installation process, which points out the general requirements. Then add a note to the effect that the reader can check up on any, hopefully minor changes via the web. The point is that you want to know a little about the general principles from a book to gage how difficult the whole thing might be.

The other chapters in this part of the book introduce CoffeeScript's modifications and additions to JavaScript. The problem is that most of them are very simple syntax changes and you don't really need to go into great detail - especially for an intermediate to advanced JavaScript programmer. The book tends to fill the space with repeated examples and comparisons with the JavaScript generated. You almost learn as much about JavaScript as you do CoffeeScript. There are also too many complete output listings - again seemingly to fill some space. What all of this means is that the book's pace is slow to leisurely which means it is a very easy read.  If you are looking for a very slow introduction to CoffeeScript that spells things out in clear prose with simple examples, this is the book you have been looking for.

Part II of the book is slightly different in that it has a lot to say. CoffeeScript In Practice takes us on a tour of the systems that the language can be used with. You can also use JavaScript with the same set of systems so again CoffeeScript has to share with its base language. The systems covered include, Cake, Jasmine and Node.js.

The final part of the book consists of three chapters explaining in great detail a big example project - a Todo list. This starts off with the server-side issues of using MongoDB, then deals with the client side using jQuery, and finally with Backbone.js.

Because of the constant switching between CoffeeScript and JavaScript this book is as much an advanced JavaScript book as an introduction to CoffeeScript. I don't know if CoffeeScript is a language that could be taught as if it was a standalone language, i.e. without mentioning JavaScript at all, but I think it could be introduced with less reference to JavaScript. This particular book treats CoffeeScript in the way that most programmers using it learn it, i.e. as an upgrade to JavaScript. If you are looking for a slow paced but clear book on the language and how to use it then this is recommended.

Banner


The Async-First Playbook

Author: Sumeet Gayathri Moghe
Publisher: Addison-Wesley
Pages: 368
ISBN: 978-0138187538
Print: 0138187533
Kindle: B0CCTZHB9N
Audience: Agile developers
Rating: 4
Reviewer: Kay Ewbank

The driver behind this book was the pandemic and the need to find ways to make remote working effective for teams. So do [ ... ]



Software Architecture In Practice

Author: Len Bass, Dr. Paul Clements and Rick Kazman
Publisher: Addison-Wesley Professional
Pages: 464
ISBN: 978-0136886099
Print: 0136886094
Kindle: B094CPJ96B
Audience: Software architects
Rating: 4.5
Reviewer: Kay Ewbank

This is the fourth edition of a book widely regarded as a classic since its firs [ ... ]


More Reviews

Last Updated ( Sunday, 11 November 2012 )