Supercharged JavaScript Graphics
Author: Raffaele Cecco
Publisher: O'Reilly
Pages: 280
ISBN: 978-1449393632
Aimed at: Intermediate JavaScript programmers
Rating: 5
Pros: Well written and full of useful and sensible discussions
Cons: Only minor criticisms
Reviewed by: Ian Elliot

Ian's verdict in October was "probably the best book I have read this year". His review is being given a re-run in case you missed it.
Author: Raffaele Cecco
Publisher: O'Reilly, 2011
Pages: 280
ISBN: 978-1449393632
Aimed at: Intermediate JavaScript programmers
Rating: 5
Pros: Well written and full of useful and sensible discussions
Cons: Only minor criticisms
Reviewed by: Ian Elliot

Don't be fooled by this book's subtitle - "with HTML5 canvas, jQuery, and More". It does cover these topics, but it hasn't sold out to being trendy and dealing with the hot topic of HTML5. In fact a very large chunk of the book could have been written back in the days of HTML4 and even earlier. Don't let this put you off because today's web graphics need a range of techniques to work well. My point is that this is a really good book and I wish it had been written ages ago. 

 

Banner

 

The first chapter starts with a topic that is especially important for graphics programs implemented in JavaScript - efficiency. The account is of fairly standard techniques, such as using a lookup table and unrolling loops, but it is well explained and complete with examples showing how much faster it makes things on each of the common browsers. What is interesting is that none of the techniques described provides as impressive a speedup as moving to the fastest browser.

Chapter 2 is where the real graphics starts and it uses DHTML - yes DHTML. This is still one of the most useful approaches to doing graphics in JavaScript because it is supported by just about every browser and it is a subset of HTML5. How to use the basic facilities provided to create sprites and how to control a complicated animation is described in detail.

While most of this is well known, it isn't known by a lot of JavaScript programmers who think in terms of a browser providing a mostly static layout. The fact of the matter is that using JavaScript you can move anything displayed on the page, and even achieve low resolution block graphics, with very little extra work. In many cases you simply do not need new features such as Canvas to do the job.

Next we move on to scrolling, which has always been a cheap and effective way of creating animations of a particular kind. Chapter 4 deals with the problem of creating a more advanced UI than HTML provides. It does cover the new features of HTML5 but its main topic is creating UI objects using JavaScript and Query UI in particular.

Chapter 5 uses the ideas from the earlier chapters to create a copy of the famous Space Invader game. The attention to detail in this reconstruction is enjoyable if you remember playing the original. After you have created a Space Invader clone using nothing but DHTML, you will believe that JavaScript can do the job. All the way through the book the code is presented as part of the text and discussion. This is the best way of doing the job and there is very little unnecessary quoting of lines and lines of boilerplate code. However, the minor downside of this approach is that occasionally you have to refer back or forward to see what is going on. Overall though this is the best way to introduce and describe code.

From here the book moves off into a set of isolated topics. Chapter 6 is about Canvas and it describes how to use it and how to create animations. The final example also uses websockets to create a chat application. The only downside of the presentation is that by the time you reach this chapter you will be wondering why you need Canvas at all. This isn't a bad attitude, however, because it will help you identify when you really do need the Canvas object.

Chapter 7 is a little odd in that it deals with the way vectors work and the relationship between the maths and the animation. Chapter 8 is on Google Visualizations, Chapter 9 on using JQuery mobile and Chapter 10 is on using PhoneGap. The inclusion of final chapters makes sense as they are ways in which you can use JavaScript graphics in a wider context than just the simple web page but they are not particularly focused on graphics in general.

Don't focus on the minor criticisms of this book. It is well written and full of useful and sensible discussions of how things work and how best to achieve a result. If you are a reasonably good JavaScript programmer and interested in graphics then you can't help but enjoy reading it. Yes, this book is fun to read and I recommend it. It is probably the best book I have read this year.


Banner


Testing JavaScript Applications

Author: Lucas da Costa
Publisher: Manning
Date: April 2021
Pages: 512
ISBN: 978-1617297915
Print: 1617297917
Audience: JavaScript developers
Level: Intermediate
Rating: 5
Reviewer: Ian Elliot
Testing the most web's fundamental language is clearly important...



Beginning Rust Programming

Author: Ric Messier
Publisher: Wiley
Date: March 2021
Pages: 416
ISBN: 978-1119712978
Print: 1119712971
Kindle: B08WZ2D7WC
Audience: Developers wanting to learn Rust
Rating: 3
Reviewer: Mike James
Everyone seems to want to know what makes Rust special. Does this book give the answers?


More Reviews

Last Updated ( Wednesday, 28 December 2011 )