Head First JavaScript Programming

Authors: Eric T. Freeman and Elisabeth Robson
Publisher: O'Reilly
Pages: 704
ISBN: 978-1449340131
Print: 144934013X
Kindle: B00J9TMSDU
Audience: Novice JavaScript programmers
Rating: 3.5
Reviewer: Ian Elliot

 

Is JavaScript suitable for the distinctive Head First format?

 

Head First books are generally aimed at the beginner and they are characterised by a seemingly chaotic presentation. If you don't know the format then it will come as something of a shock to encounter a book that has freeform notes, drawings all sorts of things that break up the logical flow. The best Head First books however managed to keep an overall logical structure and the chaos just helps to smooth the passage thought the difficult material.

How difficult is learning JavaScript?

As a stand alone language JavaScript is a bit quirky in the way that it does objects. However for a beginner you can ignore this by simply introducing it as a scripting language - that is just teach variables, flow of control and functions. You only need to mention objects as something you use not create. The problem with this approach is that as a scripting language JavaScript is fairly useless without its embedding in a web page and its interaction with the DOM. As a result you are expected to know HTML and CSS before you read this book. This said the little bits of HTML and CSS that are used are simple enough and they are even explained a little. 

Banner
 

To get you started there is a rapid overview of JavaScript and its role in things. Don't think that this introduction is light on information because it is here you meet some fundamental idea - variable, statement, decisions, expressions, conditionals and a first look at loops. Some of this material is tough and would be better left for a later chapter. For example page 23 introduces the difficult problem of handling multiple decisions and opts to show the beginner.

This first chapter really is a complete introduction to programming and JavaScript - so you had better be a quick study.

Chapter 2 moves on to making use of what you have learned to do something useful - a small game. On the way you learn how to invent an algorithm using a flow chart and pseudo code and a bit about random numbers. Chapter 3 introduces functions and a lot more difficult stuff gets covered including passing parameters, global and local variables and scope. Chapter 4 covers data structures - the array in particular and of course the associated for statement.

From here the book goes into more advanced areas and it moves very rapidly. Chapter 5 introduces objects and how to create them. By the end of the chapter you have not only encountered properties and methods but the difficult to understand this - although you won't have a clear idea of what it is all about. These are difficult topics for a beginner. 

Chapter 6 moves on to the DOM. I think it might have been better to deal with using the DOM before dealing with objects - after all JavaScript programmers spend a lot of time working with the DOM, but they generally only create a few objects, if any. 

Next we have another chapter that explains an app - battleships. This integrates HTML and CSS with the JavaScript you have learned. Then Chapter 9 introduces events, which again I think is leaving a key topic a bit late.

 

 

Chapter 10 goes back for a second look at functions and the idea of a function expression is introduced along with the idea that a function is a first class object. To prove the point you write a program that passes functions to functions. Chapter 11 goes even deeper and introduces closures, anonymous functions and nesting functions. Chapter 12 explains the use of functions to create objects i.e. as constructors. 

The book ends with a list of the things it hasn't covered - jQuery, advanced DOM, the Window object, addEventListener, old browsers, regular expressions, recursion, Json and Node.js. It's a mix of advanced topics you probably don't need to worry about until later and some things that are more basic and essential.

This isn't a bad book on JavaScript if you like the Head First approach. Its main problem is that it doesn't have a clear idea of what the average or beginning JavaScript programming is going to be doing. If you are only using JavaScript to improve a web page then you really don't need to worry too much about creating objects, only using them. You also don't need to worry about advanced use of functions, but you probably do need to know some jQuery.

The problem with this book is that it tries to explain JavaScript as an advanced programmer might see it and not as it is often used by beginners. The fact the the final part of the book mourns the fact that it hasn't covered recursion gives you an idea of what I mean. Fine, if this is what you are looking for, but be warned the elementary level of presentation makes many simple ideas seem more complicated than they need be. 

A second problem is that the introduction to the key ideas of programming are covered in a single chapter right at the very beginning. They are covered fairly well and if you stay the course then you probably are going to make the transition from non-programmer to programmer, but again it hasn't been made as simple as it could be. 

This is one of the less successful Head First books. Not because it has been poorly thought out or written, but because the subject matter isn't as suitable for this treatment as say CSS or HTML. JavaScript is a sophisticated language unless you cut it down to a core of ideas that turn it into a simple scripting language - and this is something experienced programmers find hard to do.

 

For recommendations of JavaScript books, see Building A JavaScript Library, a roundup of JavaScript classics, books for beginners, for kids and for fun.

 

Banner
 


Math for Programmers (Manning)

Author: Paul Orland
Publisher: Manning Publications
Date: January 2021
Pages: 688
ISBN: 978-1617295355
Print: 1617295353
Audience: Python developers interested in math
Rating: 4
Reviewer: Mike James
Of course you need to learn math, don't you?



Beautiful C++

Author: J. Guy Davidson and Kate Gregory
Publisher: Addison-Wesley Professional
Date: December 2021
Pages: 352
ISBN: 978-0137647842
Print: 0137647840
Kindle: B09HTH1X38
Audience: C++ developers
Rating: 5
Reviewer: Mike James
Can C++ be beautiful?


More Reviews

 

 

 

 

 

Last Updated ( Saturday, 22 April 2017 )