Eloquent JavaScript

Author: Marijn Haverbeke
Publisher: No Starch Press, 2011
Pages: 224
ISBN: 978-1593272821
Aimed at: Complete beginner
Rating: 3
Pros: An interesting perspective on JavaScript
Cons: Lots of changes in level and topic 
Reviewed by:Ian Elliot

 

Is this the "modern introduction to programming" that its subtitle claims it to be?

 

 

Author: Marijn Haverbeke
Publisher: No Starch Press, 2011
Pages: 224
ISBN: 978-1593272821
Aimed at: Complete beginner
Rating: 3
Pros: An interesting perspective on JavaScript
Cons: Lots of changes in level and topic 
Reviewed by:Ian Elliot

There certainly is a need for books that teach Eloquent JavaScript to judge by the way the language is used in most applications. This book starts off with a very elementary chapter aimed at the complete beginner. It explains what programs are, even down to what machine code used to look like and how languages evolved. All well written but strictly speaking unnecessary. 

Banner

 

Chapter 1 proper begins with a look again at the very basic things that a complete beginner would need to know. What's a value, what's a variable and flow of control. The chapter starts very slowly but the level starts to ramp up. By the time you reach program structure the author is starting to reveal the book he really would have liked to write, i.e. an advanced one.He starts to introduce some doubtful practices such as if statements without brackets - recommended even for single line if statement and breaking out of loops. By the end of the chapter we are dealing with automatic type conversion and Boolean operators.

Chapter 2 is about functions and it still attempts to start slow and be kind to the beginner, but the pace, level and language is getting tougher all the time. The introduction of "Nested Scope" on the third page of the chapter just after dealing with elementary topics should give you an idea of what I mean. We next have discussions of the call stack, returning values and closure. If the introduction of closure in a first look at functions doesn't convince you that the level is going well above the beginner, then perhaps recursion on page 37 will.

From here on each chapter starts with an attempt to appeal to the beginner but rapidly spirals off into esoteric and difficult subjects. Chapter 3 is about data structures - objects and arrays.  This starts off as a complete beginner's intro to objects but by the third page it is diving into mutability. The rest of the chapter goes over date representation and some built in objects.

Chapter 4 is on error handling - how to use the try-catch. This is probably a bit early for the beginner to be worried about such niceties.

Chapter 5 is where the book finally shows its true colors with a look at the first of three of the main design philosophies - functional programming.  In this chapter we learn about higher order functions and invent map and reduce functions - not really beginner's stuff. The rest of the chapter is an odd (and completely misplaced) fairy tale about HTML and we have gone back to appealing ot the complete complete beginner. Another look at functional programming completes the chapter. 

Next we have a chapter on object-oriented programming.- a classical introduction to the way JavaScript handles objects including the use of prototype and the subtle ways "this"  works. The chapter ends with a large example.

Chapter 7 discusses modularity, which is odd to find coming after object oriented programming. This explains the standard tricks for implementing namespaces and interfaces.

The remainder of the book turns to practical matters Chapter 8 explains regular expressions; Chapter 9 applies JavaScript to web programming; Chapter 10 is on using the DOM; Chapter 11 is about browser events; and Chapter 12 is about making HTTP requests, i.e. Ajax.

This is a difficult book to come to a conclusion about. It attempts to appeal to the beginner but treats material that really is better suited to the more advanced programmer. The problem is that the beginner material does detract from the presentation of JavaScript as an advanced modern language. It would have been better if the author had simply written a more advanced JavaScript book. Even here, though, the depth and organisation isn't sufficient. JavaScript is a dynamic functional language that takes it own particular approach to objects. One of the big problems with this is that we still haven't really worked out how to teach it as a modern language and this book simply represents the standard approach.

So it's not a bad book but it isn't the "modern introduction to programming" that its subtitle claims it to be. If you are a beginner then I would suggest that you start with something that doesn't tackle such difficult subjects and come back to this book after you have learned how to write some JavaScript programs.  If you are an intermediate JavaScript programmer then you will get a lot from reading this book if you can put up with the beginners material at the start of each chapter.

Banner


The C# Workshop (Packt)

Author: Jason Hales, Almantas Karpavicius and Mateus Viegas
Publisher: Packt
Date: September 2022
Pages: 780
ISBN: 978-1800566491
Print: 1800566492
Kindle: ‎ B0BGRBDJLS
Audience: C# developers
Rating:  4
Reviewer: Mike James
C# is not the language it once was - time for a revival?



Learn Enough JavaScript to Be Dangerous

Author: Michael Hartl
Publisher: Addison-Wesley
Date: June 2022
Pages: 304
ISBN: 978-0137843749
Print: 0137843747
Kindle: B09RDSVV7N
Audience: Would-be JavaScript developers
Rating: 2
Reviewer: Mike James
To be dangerous? Is this a good ambition?


More Reviews

Last Updated ( Monday, 07 February 2011 )