on 26 October 2013
Underscore provides a set of useful functions that allow you to write shorter, more expressive code. If you are familiar with the ECMA5 array methods map, reduce and filter then you can expect browser independent implementations of those along with a load of additional utility method that can help simplify data transformations. If that is all new to you it may be worth having a play around with them before taking a look at the Underscore site.
on 23 August 2015
To save himself developing a suite of boilerplate to underpin his functional style, Fogus uses the well-known Underscore library; initially to draw some of his early examples from real life usage, and subsequently as a background framework for the whole book. (You may, like me, prefer the alternative LoDash implementation of the same interface, which will disadvantage you not at all as far as this book is concerned.) However, the book is not about Underscore, and the author only uses it as a background to his main aims. Indeed, the code throughout is general-purpose and environment-independent; not tied to, for example, web browser programming or a Node-madic existence.
Fogus's prose style is fairly light and entertaining - he know to put in some jokes without steaming up the lens with excessive humour. His ambition is admirable: these are quite complex techniques that are worth understanding: one can sense his enthusiasm and his desire to put things across. He has a good eye for a bit of code that demonstrates an idea in short form without being unbearably patronising. He occasionally pursues his red herrings a bit far, or attempts a line of discussion which doesn't really help much: I'd put the long discussion of scoping at the start of chapter 3 in this category. But much more hit than miss.
There is 'but' that is implied by the missing star: I think the author has really been let down by his O'Reilly editor and his proofreaders. The first thing to do on getting hold of this book (in paper form) is to google up its errata website and ink in all the corrections. Really. Some of the proofing errors are doozies, if you take the book seriously you'll have enough on your plate following its thread without refinding what others have already flagged.
Once you have done this, don't put your red pen away. Fogus has the habit of supplying a function once and then referring to in code several chapters later. For example, construct() is a one line function introduced without any particular emphasis on page 39 in Chapter 2; when it resurfaced on page 116 Chapter 6 I had entirely forgotten it, and it is not in the index. This happens quite a lot, and it can be a sod to track the original down. Another irritating systematic failure: Fogus inserts his references in the academic style '(Touretzky 1990)', but his bibliography lists his sources by title, ordered by the order they happen to be on his bookshelf - making the references tedious to resolve. Apart from this sort of thing, minor typos litter the book, but that perhaps infuriates only sad obsessives like myself. But from O'Reilly, I expect more.
Otherwise: yeah, go for it.
on 19 September 2015
It also gives a good introduction to the Underscore library, which I have used for a few years and now feels very much like the missing part of the language for me.