You are on page 1of 3

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/262165628

Effective JavaScript: 68 specific ways to harness the power of JavaScript by David


Herman

Article  in  ACM SIGSOFT Software Engineering Notes · November 2013


DOI: 10.1145/2532780.2532791

CITATION READS
1 10,710

All content following this page was uploaded by Holger M. Kienle on 26 January 2015.

The user has requested enhancement of the downloaded file.


ACM SIGSOFT Software Engineering Notes Page 40 November 2013 Volume 38 Number 6

Book Reviews
Effective JavaScript: 68 Specific Ways
to Harness the Power of JavaScript
David Herman
DOI: 10.1145/2532780.2532791
http://doi.acm.org/10.1145/2532780.2532791

Effective JavaScript: 68 Specific Ways to Harness the Power


of JavaScript is written by David Herman, and published by
Addison-Wesley, © 2013 (paperback), ISBN 0-321-81218-2,
206 pp., USD 39.99.
Let me confess upfront: I am fascinated by JavaScript’s
features and its silent ascent to become one of the most
important programming languages, enabling the Web 2.0 as we
see it today. I have voiced the opinion in 2010, that “it’s about
time to take JavaScript (more) seriously” and the stream of
JavaScript books that have come out since then seem to confirm
this notion.
The creator of JavaScript, Brendan Eich, states in the forward
section of the book that he created JavaScript in ten days and
that it “is far from quirk-free or restrictionist.” In response, this
book presents 68 idioms on how to use the language, and these
idioms are thematically grouped into 7 chapters.
Chapter 1 is mostly concerned with lower-level language
mechanics that can easily cause subtle problems. Implicit type
conversion (coercion) is one such troublesome area—except of
course you consider it normal that 3+true yields 4. Chapter 2
discusses scoping, closures, anonymous/named functions and
immediately invoked function expressions. The latter is an idiom
for the creation of a local scope, which is not directly supported
by JavaScript. Chapter 3 focuses on functions. There is usually
confusion about plain functions versus methods and constructor
calls in JavaScript because there is no syntactic difference
between them. The first item in this chapter clears this up.
Chapter 4 deals with objects, making it clear that JavaScript has
“no built-in notion of classes” (!) and that dispatching is
achieved through a chain of prototype objects. Reading this
chapter shows the beauty of the language and can save you lots
of head-scratching when reading JavaScript tutorials from
authors that did not grasp JavaScript’s object system. Chapter 5
explains arrays and dictionaries. This part of JavaScript deserves
to be called quirky and the covered idioms can save you lots of
trouble by pointing out proper uses and how to avoid nasty
surprises. (Yes, you always guessed it: there is a difference
between arrays and array-like objects.) Chapter 6 gives hints on
designing APIs, which are not necessarily specific to JavaScript.
These hints are not only useful if you want to write a true
library, but also if you are the sole client of your own code.
Chapter 7 closes the book with idioms for concurrency. Since
concurrency is another area that is little understood and not even
standardized, I would expect that even JavaScript experts will
find the discussions valuable.
As the summary of the chapters shows, this is a book that
delves seriously into the JavaScript language. However, I found
the reading quite pleasurable and diverting. A big part of this is
due to the large numbers of smaller but self-contained code
samples that clearly illustrate each point that the author wants to
get across. You could certainly type in the examples and
ACM SIGSOFT Software Engineering Notes Page 41 November 2013 Volume 38 Number 6

experiment with them alongside reading the book, but you could
also read the book on a bus ride and run the examples only
through your head. Also, it’s motivating that each idiom is
usually self-contained and can be read through and understood in
a few minutes. Readers that are already quite familiar with
JavaScript can directly jump to a specific chapter or idiom that
catches their interest.
After reading the book, you should be able to blend in with
die-hard JavaScript programmers—throwing around lingo such
as iffy, polyfill, monkey-patching and duck typing. While the
book covers JavaScript’s quirks, it also shows where the
language shines, especially its lightweight syntax to create
objects, functions and arrays and its object model where “an
object can represent a fixed record of name-value associations,
an object-oriented data abstraction with inherited methods, a
dense or sparse array, or a hash table.”
Where needed, the book clearly states the differences
between the two major language editions (ES3 and ES5) and
where vendor-dependent behavior must be expected. As should
have become apparent by now, the book’s focus is on lower-
level (language) idioms rather than higher-levels patterns.
Especially, after reading this book don’t expect to be able to
program with JavaScript in a class-based or functional style.
Also, don’t expect any content on web programming and the
interactions of JavaScript with CSS and HTML.
I very much like that the book is written in a manner that
makes it pretty much as “timeless” it can get considering its
topic. On the positive side, this means you can expect that this
book will serve you well for years to come. On the downside,
don’t expect any recommendations on JavaScript engines and
their performance, or on hot libraries, debuggers and
development environments.
All in all, it’s a worthy addition to the publisher’s Effective
Software Development series. Still, before you commit to the
book, you should know that recently a bunch of other books on
JavaScript have come out that may be also worthwhile to
consider.
Lastly, if you are concerned about environmental issues you
might like to know that the publisher has informed me that this
book has no particular forest certification. However, it’s
encouraging that the publisher has assured me that there are
procedures and partnerships in place that address such issues.
Reviewed by Holger M. Kienle, hkienle@acm.org.

View publication stats

You might also like