JavaScript Cookbook (2nd Ed)

Author: Shelley Powers
Publisher: O'Reilly, 2015
Pages: 634
ISBN: 978-1491901885
Print: 1491901888
Kindle: B00SS9G9DC
Audience: Intermediate JavaScript programmers
Rating: 4.5
Reviewed by: Ian Elliot 

A cookbook for the more advanced programmer? Is this a good idea?

 

Cookbooks are always difficult to review because how you react to them depends on whether the topics you are interested in overlap with the recipes presented. Then there is the small matter of the level. Generally cookbooks aim low and largely of use to beginners needing to put boilerplate code together to get something that works. In this case however the cookbook seems to be aimed higher. It covers a very wide range of topics but they all seem to be challenging rather than introductory. This certainly isn't a cookbook for the complete beginner. 

 

Banner

 

Part I: Classic JavaScript and essentially it corresponds to writing ECMAScript 5 in the browser. The first chapter is called Not So Simple Building blocks and it is a mixed bag of basic things to do - extract a list from a string, use closure with timer routines, calculating the length of a circular arc. A very mixed bag with little connection between the topics. From here we move on to arrays, functions and the JavaScript object. After this thing take a less language oriented turn and we have a chapter on working with the DOM and generally dealing with the UI. Chapter 6 is on testing and accessibility; Chapter 7 is on libraries both using and creating; Chapter 8 is about Ajax and the final chapter in the section is about SVG, video and Canvas. 

 

 

Part II: JavaScript, All Blown Up, which is a funny title, deals with the latest topics in JavaScript. Chapter 10 is about the new ECMAScript, using let, yield, promises and so on. Chapter 11 is a brief look at Node.js topics. It is really an introduction to Node.js written in cookbook style. Chapter 12 is about modularization and management and ranges from basic HTML 5 asynchronous loading though RequireJS to Node.js modules. 

Chapter 13's title, "Fun with APIs", is a bit of mystery . Why fun and why the particular APIs selected: Rest, webworkers, Google Maps, Twitter and the File API. 

Chapter 14 is about Frameworks and it is a slightly odd take on the topic. We start with Express, later encounter OAuth and end with web components. Chapter 15 takes up the Ajax communications topic but at a slightly more advanced level. Chapter 16 is about data visualization using D3 and some interesting things with websockets, PhantomJS, Ocrad.js and cropping images. Chapter 17 deals with data and persistence. After a quick look at traditional forms and validation we have MySQL and IndexDB. 

The final chapter takes us well out of the usual JavaScript fare and looks at writing mobile apps using Cordova (PhoneGap). It looks at recipes for the Amazon AppStore, Firefox OS and  Chrome Apps.

This is a very different cookbook from the average and if you have the first edition this second one is quite a different book. Many of the old recipes are included but there are many new topics. The explanations are often on the too-brief side, but if you like code there is plenty of it to illustrate how things work. 

javascriptcookbook2e

The key thing is that this is not a cookbook for the beginner. The recipes tend to try to do things that the beginner just wouldn't consider, such as using IndexDB to persist data. Indeed, a beginner probably hasn't thought about the problem of persisting data much at all. Even the chapter titles seem to challenge you to step up to the mark. For example, what standard cookbook would start with a chapter titled "The JavaScript Not-So-Simple Building Blocks"? Most would start off with "Very easy things to do with variables". 

My only reservation about the book is that it might have been a lot better as an intermediate to advanced JavaScript textbook, abandoning the cookbook style. Of course, if you like your information in recipe-style chunks then you will not agree. 

This book isn't perfect but it is very useful - recommended. 

Related

JavaScript Beginners Book Choice

 

Banner


Reliable Source: Lessons from a Life in Software Engineering

Author: James Bonang
Date: January 2022
Pages: 608
Kindle: B09QCBVJ9V
Audience: General interest
Rating: 5
Reviewer: Kay Ewbank

This book combines a fun read with interesting insights into how to write reliable programs.



Functional Design (Addison-Wesley)

Author: Robert C. Martin
Publisher: Addison-Wesley
Date: September 2023
Pages: 384
ISBN: 978-0138176396
Print: 0138176396
Kindle: B0CGHQKGYG
Audience: General
Rating: 4.5
Reviewer: Kay Ewbank

This book sets out to explain the principles, patterns and practices of functional design, and why functional prog [ ... ]


More Reviews

Last Updated ( Monday, 28 August 2017 )