The joy of JavaScript

0

Author: Luis Atencio
Publisher: Manning
Date: March 2021
Pages: 360
ISBN: 978-1617295867
Print: 1617295868
Audience: JavaScript developers
Rating: 4
Reviewer: Ian Elliot
Joy you tell me!


The Joy of JavaScript – I agree that there is a lot of joy in the language, even if some disagree. JavaScript is an idiosyncratic language in the age of strongly typed, class-based, object-oriented languages, and Java certainly isn’t. A book that promotes the language is unlikely to sell to a complete beginner who lacks the necessary brain modules to even conceive that a language can hide some joy. Obviously, this is for the reasonably proficient JavaScript programmer who wants to improve their knowledge and how they use the language.

Now we run into a problem because this book will only be truly joyful for you if you want to take the functional approach. Functional programming is not for everyone and some believe it introduces unnecessary barriers to just coding. The programming is hard enough without introducing artificial difficulties that must be overcome. Of course, you might believe that functional programming is the only way to do things. In this case, you will also be disappointed because JavaScript is not a functional language. At best, you can take a function-oriented programming approach which, used in the right place, is a good thing.

So we have a book that sells a programming methodology rather than a language. The JavaScript part of the joy is incidental and you might even say a bit of a damper.

The first chapter begins with an overview of JavaScript. Only this is not the case. Rather, it’s an overview of some functional programming ideas with an angle towards JavaScript. The book really starts with part 1 on objects and we get the usual look at prototypical inheritance, constructors and class-based inheritance. The last chapter of the section focuses on linked and compositional approaches to objects.

Part 2 is about functions – as you’d expect, they play an important role in functional programming. Here we learn what functional programming is – curry, closure, immutability and side effects. Later we discover even more advanced ideas – functors and monads. This is very functional programming as opposed to how a typical JavaScript programmer might use functional composition, chaining, or mapping to get the job done.

Part 3 is called Code – which doesn’t give much idea what it is. It covers modules and metaprogramming. At least JavaScript is the star of this section, and you’ll learn a few ways to use mystery symbols.

Part 4, the last part, is called Data, which logically follows a section called Code. It mainly focuses on asynchronous programming – promises and asynchronous/await. You also learn about streams, including generators.

All in all, that’s really not the joy of JavaScript, that’s the joy of functional programming using JavaScript as an example language. It’s fine if you really wanted to learn more about functional programming, but not so great if you really wanted to learn more about JavaScript. The view of JavaScript as a functional programming language is at best only a half-appreciation of the big picture. JavaScript is a multi-paradigm language with its own strengths that aren’t particularly tied to a single, all-encompassing approach.

The joy of JavaScript is to use the parts that suit the problem at hand. If you think functional programming is the key to the universe, then you better seek joy in Haskell, for example. On the other hand, if you want to learn more about functional programming and need to use JavaScript, then why not read this book as it fills that niche quite well.

For more JavaScript book recommendations at this level, see Advanced JavaScript Book Picks in our Programmer’s Library section.

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to the I Programmer’s Books RSS feed for daily Book Watch releases and new reviews.

Banner


joyjava

Share.

About Author

Comments are closed.