Shop now Shop now Shop now  Up to 50% Off Fashion  Shop all Amazon Fashion Cloud Drive Photos Shop now Learn More Shop now Shop now Shop Fire Shop Kindle  Learn more Countdown to Prime Day Shop now Shop now

Customer Reviews

4.2 out of 5 stars5
4.2 out of 5 stars
5 star
2
4 star
2
3 star
1
2 star
0
1 star
0

Your rating(Clear)Rate this item
Share your thoughts with other customers

There was a problem filtering reviews right now. Please try again later.

on 26 October 2013
This book certainly isn't perfect. There are several minor errors in the printed code and output examples, so you probably want a good enough understanding of Javascript to be able to pick them out. Towards the beginning I found it would ramble in places and lead off on some odd tangents. Also, some of the examples comparing functional to imperative code seemed to unfairly attribute good programming practices to functional style. Examples include: returning early and avoiding the use of superfluous variables. Despite a few minor issues I still rate this book highly as I learnt lots of new and interesting things from it.

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.

Some of the content in the middle of the book repeats some of the stuff I have read in other Javascript books, such as The Good Parts, Javascript Patterns and Effective Javascript, but here the author does a better job of showing practical uses for functional style and explains what aspects of functional programming Javascript is best suited to. Up until now I hadn't really understood why i would want to use currying. It usually gets presented in its arbitrary length form as something you can do, but without reason as to why. Learning about partial application was one of the most fun bits, it allows you to write programs in a very different form. You may need to try applying the code in a practical context to fully realise the benefits, for me they were not always immediately apparent from reading the examples in the book alone.

There is a section on mutability that shows to good effect how referential transparency can help reduce bugs in code, but some of the other techniques for dealing with the mutability of Javascript objects seemed like nasty hacks battling with the language. Another good chapter explains chaining, lazy chaining deferred objects and pipelines. Deferred object are featured in many libraries, but in my experience were not always all that well documented. I can certainly see myself using pipelines in the future too.

At the end of the day, even if you are not particularly interested in functional programming, if you work with Javascript it's worth learning since most libraries have at least some functional aspects, plus you'll probably gain some appreciation for it along the way.
0Comment|9 people found this helpful. Was this review helpful to you?YesNoReport abuse
on 23 August 2015
Functional JavaScript is a written as a working programmer's guide to melding a functional approach with the not-particularly-functional-even-if-better-than-Java JavaScript language. It takes a tutorial approach, leading the reader through a sequence of admirably compact code examples to demonstrate the selected functional techniques: higher order functions, recursion, immutability and pure functions.

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.

There are a lot of good things to say about this book. One thing is that it is, in places, quite dense, but somehow sustains the illusion that it is an light read (I also found this with Crockford's JavaScript: The Good Parts). It is quite easy to sail through chapters and suddenly realise that one has no clue about how a fragment of code works, and discover the need to backtrack a page or two and try again, with concentration turned up a couple of notches. This may sound like a criticism, but really it isn't: books that flatter and tempt the reader into wading out beyond his depth without realising it are actually the books that, in the end, create new swimmers. It is the one that bore you rigid that should be avoided.

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.

Also, Fogus is not above letting the boys have their toys. JavaScript notoriously can't optimise tail-recursion, so here is a coded up work-around that is fun to implement and will blow the heap before it blows the stack. Possibly not particularly practical, but hey! JavaScript can do it, dude.

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.
0Comment|Was this review helpful to you?YesNoReport abuse
on 19 September 2015
If you're interested in taking your JavaScript to a more advanced level, this is a great book showing the functional side of the language ( which is strongly influenced by Scheme during its creation ) and giving you a chance to use it to explore functional programming techniques. I have read a few books on functional programming and the concepts have never fully stuck, but this one - perhaps because it starts with a language I already know in depth - has really helped me to grasp them and to see places that they would be useful.

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.

If you are an experienced programmer who wants to improve your JavaScript this is well worth a read, particularly if you come from a more object-oriented background in a language like C# or Java and you find yourself spending more time than you would like trying to understand what "this" refers to at any given point, this will really help.

An ideal follow-up to "The Good Parts" in any JavaScript programmer's education.
0Comment|Was this review helpful to you?YesNoReport abuse
on 5 July 2015
Is not a bad book. Maybe I was confused. Basically it teach you 80% the underscore api and 20% examples of how to nest functions to do functional programming.
0Comment|Was this review helpful to you?YesNoReport abuse
on 24 October 2015
No problems.
0Comment|Was this review helpful to you?YesNoReport abuse

Send us feedback

How can we make Amazon Customer Reviews better for you?
Let us know here.

Sponsored Links

  (What is this?)