Learning JavaScript

Author: Tim Wright
Publisher: Addison-Wesley
Pages: 360
ISBN: 978-0321832740
Audience: Web designers wanting to become developers
Rating: 1
Reviewer: Ian Elliot

With the subtitle: A Hands-On Guide to the Fundamentals of Modern JavaScript this book promises quite a lot.

What exactly is "Modern JavaScript"? Most programmers would think it is the sort of object-oriented code written in the sort of demo web app that is used to show off Chrome or IE. So a book that promises to introduce you to modern JavaScript is an exciting prospect. Sadly this isn't what the book does.

This is a very traditional introduction to the way JavaScript is used to improve the typical web page. It even starts off by explaining the idea of progressive enhancement and graceful degradation. These are the key ideas if you simply want to add a bit of inline JavaScript to an existing webpage to make it look better in a browser that supports JavaScript. if your intention is to create a web app then the idea of falling back to HTML only is just silly.

Banner

So this is not a hard core coders book. It is essentially a book that show how to use JavaScript to enhance and add facilities to a web page. It is a designer-becomes-programmer sort of book, which is a good thing and fulfills a need. The only problem is that if you are a complete beginner to programming this book isn't going to help. It starts off discussing issues that only become important after you know how to program. Indeed the book really doesn't tell you much about programming at all. The first chapter is about progressive enhancement - essentially why you should use JavaScript and how. Then it goes on to JavaScript in the browser - i.e. the DOM but plus a lot of detail on how a browser works.

Chapter 3 is where you might hope that the real JavaScript introduction gets going, but it really is just a list of topics presented in an order that really doesn't make much sense. You will also find a lot of confusion with talk of cache, arrays, associative arrays and so on. Using an array as an associative array is a well-known bad practice, but this book doesn't seem to make the distinction between an object used as an associative array and an array used as an associative array. The real core of programming, loops, conditionals and so on are relegated to a short section at the end of the chapter.

From here the book gets into deeper waters. Chapter 4 discuses the DOM and how to work with it. Notice that we haven't really come to terms with JavaScript objects at this point - i.e. we know nothing of constructors, or why you might want to use objects. Instead we simply learn about how to retrive particular objects by class, Id and type and add and remove objects.

Chapter 5 deals with storing data in JavaScript and this is not what you might expect. It is a basic primer on variables - strings, numbers, boolean and so on. Next it deals with arrays and objects used as vehicles for JSON data. Later we get on to HTML5 storage - local and session. This is a horrible confusion of basic facilities i.e the idea of a variable and complex subsystems. Chapter 6 introduces the idea of functions - beltadley -  and returns to the topic of flow of control with another look at loops and conditionals.

Chapter 7 introduces events and event handling including, a look at touch and orientation events. Then on to Ajax, an important topic, but remember basic programming concepts were only introduced a chapter earlier. Then we switch levels again to look at code organization. which is basically a style guide plus some hints and tips.

The final two chapters deal with more advanced material - using libraries, which is about jQuery, and HTML5 which covers APIs such as geolocation, audio etc.

This book isn't about modern JavaScript; it's about using the language in the way that it tends to be found in web pages. However, it focuses on making use of recent facilities such as those provided by HTML5 and this is the only sense in which it is modern. It also takes a very distant view of what programming is all about. This is programming as a craft targeted at augmenting web sites and as such it has a narrow view. For some applications the view is sufficient to get the job done, but it isn't going to allow you to rise to the challenge of writing anything that resembles a web app or even a web page that is heavy on client-side facilities.

There are also some very odd omissions. For example, there is nothing about error handling or the try..catch statement. There are no advanced techniques such as closures, encapsulation  and absolutely nothing about object oriented programming. The idea of a constructor, local variables, prototype and other basics of JavaScript objects are simply missing.

OK, you may say this book isn't for advanced JavaScript programmers - it aims to teach good but basic JavaScript to non-programmers. The problem is that it doesn't do this at well either. It makes no attempt to get complete beginners to understand the basics of programming. The order that topics are introduced isn't logical and it isn't helpful. The best that can be said is that if you already dabble a bit in JavaScript you might pick up a better approach to the language and what it is used. for. Even in this case it would be a shame because for the same effort you could have learned how to use the language properly. Avoid this book if you can.

See also:

JavaScript Books 2012 on Programmer's Bookshelf

Banner


Coding All-In-One For Dummies

Author: Chris Minnick
Publisher: For Dummies
Pages: 912
ISBN: 978-1119889564
Print: 1119889561
Kindle: B0B5BBNW9L
Audience: People wanting to learn to code in JavaScript, Flutter and Python
Rating: 3.5
Reviewer: Kay Ewbank

This book is described as offering an ideal starting place for learning th [ ... ]



Code: The Hidden Language of Computer Hardware and Software 2nd Ed

Top Book 2023
Author: Charles Petzold
Publisher: Microsoft Press
Date: August 2022
Pages: 480
ISBN: 978-0137909100
Print: 0137909101
Kindle: B0B123P5GV
Audience: General
Rating: 5
Reviewer: Mike James
Code! We all need to know about it.


More Reviews

Last Updated ( Thursday, 18 October 2012 )