Slashdot Mirror


Book Review: Head First HTML5 Programming

Michael J. Ross writes "Web designers and developers alike are increasingly enthused about the capabilities offered by HTML5, which is generally considered the combination of the latest version of the Web's primary markup language and its related technologies. Consequently, publishers have rushed to market a wide variety of books that purport to explore the inner mysteries of HTML5, even as the standards — and how browsers implement them — are still in flux. In characteristic fashion, O'Reilly Media took the time to wait for some of the dust to settle, and attempted to create a resource more approachable and solid than those thrown together quickly. The final result is Head First HTML5 Programming." Read on for the rest of Michael's review. Head First HTML5 Programming author Eric Freeman and Elisabeth Robson pages 608 pages publisher O'Reilly Media rating 7/10 reviewer Michael J. Ross ISBN 978-1449390549 summary A heavily-illustrated introduction to building web pages and web apps with HTML5. The release of this book is quite timely, given the current developments in web technologies. As one of the underpinning components, HyperText Markup Language (HTML) has undergone tremendous change during its two-decade history — with new element names and attributes being added to try to keep up with the latest multimedia formats, design techniques, and other factors in the Internet's evolution. Even though this newest major revision, HTML5, is still not completely supported by most browsers, much of its capabilities are already available, to one extent or another. Also, forward-thinking designers and developers are not waiting for the final blessing by the W3C to begin learning what they can do with it now and in the future.

This book was written by Eric Freeman and Elisabeth Robson, both of whom possess a lot of experience with the subject matter. This title was released on 18 October 2011, under the ISBN 978-1449390549. Its considerable size, 608 pages, is partly due to the extensive use of humorous pictures, actors, scenarios, clever drawings, and a generous use of whitespace — characteristic of other titles in the Head First series. At first glance, these elements might seem like cartoonish gimmicks, meant only to boost the page count or keep graphics employees busy. Actually, these methods are intended to help readers retain the new knowledge, and make the learning process more pleasant. This approach is covered in more detail in the book's introduction.

The material is organized into ten chapters, followed by an appendix. The only technical prerequisite, for prospective readers to get the most out of the book, is a solid understanding of HTML and CSS. Some JavaScript knowledge would be helpful, but is not necessary. On the publisher's page, visitors will find more details about the book, a couple reader reviews, some brief author bios, links to purchase the print and electronic versions (PDF is the only format), and the reported errata (of which there are eight, as of this writing). The example code and other files for the book can be obtained from WickedlySmart.

The first chapter introduces HTML5, at a high level and a fast pace, focusing on the new features that it offers, such as the new JavaScript APIs: embedded video and audio (without the use of plug-ins), client-side data storage, off-line web apps and caching, geolocation, canvases, sockets, Web Workers, and advanced capabilities for forms and drag-and-drop. JavaScript is also introduced, with some simple example code. Much more detail is presented in the subsequent chapter. The only confusing point is, on page 53, when the authors state that there are three different ways to add JavaScript code to a web page, but the figure shows four permutations. The third chapter explains how to work with events and handlers, using a simple music playlist app to illustrate the ideas. In the subsequent chapter, functions and objects are explored in much greater detail, and the presentation is quite methodical and comprehensible.

With Chapter 5, "Geolocation," the authors shift from establishing a foundation of basic JavaScript knowledge, to showing how to apply it for constructing web applications. In the case of geolocation, readers are stepped through the process of building a simple web app that detects the user's current position, displays it on a Google map, and tracks any changes in the position. The next chapter shows how to make one's code work with web services, using the JavaScript communication APIs, and why JSONP bypasses the problems with XMLHttpRequest requests being blocked for security reasons by the JavaScript same-origin policy. The presentation is solid, except for the claim on page 257 that the callback receives an object, when actually it receives an array of objects. Chapter 7 explicates the new canvas element, which offers capabilities encroaching upon the realm of Adobe's Flash. The next chapter, titled "Video," is a logical continuation of the discussion on the canvas element, because the latter allows one to do a lot more with the video API. The authors demonstrate how to do that, after discussing the different video formats and techniques for writing robust HTML to accommodate as many brands and versions of browsers as possible.

HTML5 has taken the venerable browser cookie, and extended its storage capacity tremendously, in the form of the local storage API (a.k.a. "Web Storage"), which is addressed in the penultimate chapter. Sadly, no troubleshooting information is provided in case the reader finds that the example code does not work in Firefox, even when using a web server (i.e., "http://" instead of "file://") — and instead fails quietly with an error message "localStorage is null" in the JavaScript error console. (For those who are interested, one source of the problem is when the Firefox configuration preference "dom.storage.enabled" has somehow been set to "false.") The tenth and final chapter, "Web Workers," shows how to utilize multithreading in JavaScript code to improve its performance, when possible. Readers using Firefox 8.0 (the latest version as of this writing) will likely find that the example code does not work on a localhost, throwing a "Could not get domain" error message, as a result of a known bug. The appendix briefly covers ten additional topics not discussed in the chapters, including Modernizr, the audio element, jQuery, XHTML, SVG, and more.

With a book this size, it is inevitable that it will contain various blemishes. Some of them are a result of the book production process: In the text, JavaScript tokens are not distinguished from English words in any manner (such as a monospace font or bolding), which can trip up the reader. On some of the two-page spreads, the portions of the images and arrows get lost in the book's gutter. In the many illustrations involving one or more persons saying something, their statements are shown in thought bubbles, which is mildly but invariably disconcerting. Other flaws are results of the writing and/or editing: Commas are oftentimes used where semicolons or periods were called for, or just missing altogether — especially in the mock interviews. Sometimes the conversational style — characteristic of the Head First series — becomes a bit too casual, and in some places the authors are trying too hard, such as the repeated use of "skool."

The example code is generally of good quality, but not always consistent; for instance, is employed in some places, but elsewhere — leaving the reader to wonder why. Also, there's at least one case of (incorrect) curly quotes in the code (page 454). It is helpful to have the example code available for download, although it would have been decidedly better had the root directory of the archive file contain an index.html pointing to all of the included apps, so readers could bookmark that single starting point, rather than having to modify their browser's URL each time. In addition, it is oftentimes not obvious as to which chapter subdirectory corresponds to any given location in the book.

However, the main problem with this book is the sloppy editing, evidenced by the notably high number of errata: "pin point" (page xiv), "test editor" (xxii; should read "text editor"), "iPhone" (xxv; should read "HTML5" or something similar), "folks that" (xxxi; should read "folks who"), "get [a] sense" (1), "on the page 2" (3), "can you get a long way" (21), "assign it [the] empty" (26), "you can also thrown in" (40), "its got" (46), "Your job is the act like" (57), "lets concentrate" (58), "get [the] length" (68), "Go ahead an open up" (90), "What you can" (129; should read "What can you"), "a object" (142), "an new object" (147), "to to" (158), "you [are] saying" (158), "users location" (166), "south" (167), "three properties" (177; should read "four properties"), "google" (186), "including [the] last two methods" (192), "give it a try it" (218), "will use" (220; should read "we'll use"), "take a 90 milliseconds" (221), "the this code" (249), "with out with" (268), "HTML =" (271; should read "HTML5 ="), and "an drawable region" (285). These are just the errata found in the first half of the book. Fortunately, they are in the narrative, and not the example code, which would have had a much more negative impact upon the reader.

This book is definitely an introductory tutorial, and by no means a reference. Not all of the new HTML5 elements are covered, nor is CSS3 provided full coverage. The repetition of concepts may aggravate experienced or impatient programmers: For people with some experience with these technologies, and for people who readily glean information from technical books upon first exposure to the given concept, the frequent repetition in this book would border on tiresome, if it weren't presented so pleasantly, oftentimes with humor. On the other hand, the Head First books are predicated on the approach of presenting information in different formats, to maximize learning. Any newbie should appreciate this volume's clear explanations, even if they are presented multiple times, but differently. Also, there is plenty of testing of one's knowledge, to reinforce what has been learned.

Head First HTML5 Programming is an entertaining yet instructive and compelling tutorial on how beginners can learn to use many of the advanced new techniques in HTML, CSS, and JavaScript.

Michael J. Ross is a freelance web developer and writer.

You can purchase Head First HTML5 Programming from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

13 of 90 comments (clear)

  1. Honest question by bonch · · Score: 4, Interesting

    How many people here still purchase physical computer programming books? I can understand doing so for high-level concepts, where you'd expect to read the book from beginning to end, but for tutorials or reference material, why wouldn't you just look it up online for free? I can't really picture myself sitting down and reading a physical book about HTML5.

    1. Re:Honest question by PyroMosh · · Score: 5, Insightful

      Probably not for something like HTML, no. But for a new language, I'll pick up a book. Books will often be better constructed than online tutorials. YMMV of course.

      I've always liked The Head First series in particular for some things. Especially for exposing someone who is new to a language or concept. The series is very novel and always reminded me of the "hers's how to do something fun" approach that the BASIC programming books I cut my teeth on had.

      Is it any good for an experienced Java Programmer who wants to pick up C# or Objective C quickly? No. But they absolutely have their place.

    2. Re:Honest question by Anonymous Coward · · Score: 5, Insightful

      I still have my physical tech book addiction because I'm not online 24/7 like most others. Hell, I don't even have an internet connection at home, which means a lot of "online learning" is right out the window. Furthermore, I can lounge read a lot of books, while sitting on the can, lounging on the couch, or laying in bed. While I might not be "typing in code" examples, I can definitely read through references, APIs, code examples and what not and file that away mentally for later. Not to mention, dog-ears, writing out notes in margins, highlighting, etc, are MUCH easier on my physical books than anything I've found digitally. I'm not 100% attached, however, as tablet technology is getting closer to what I want in an e-learning experience, but we're still a couple gens out from a "I would use this" standpoint. YMMV.

      As for "why wouldn't you just look it up online for free?" Jesus christ, there's a ton of absolute SHIT sites out there with shitty code that may or may not work. While books aren't immune to it, I would think with an actual editoral process and some peer review, this is much less of an issue than some of the shit out there that is waved around as some sort of best practices of morons.

    3. Re:Honest question by JonySuede · · Score: 5, Interesting

      I forgot to explain why reading offline is better than reading the same material on a computer. It is a better way because it forces single-tasking and we all should know by now that the brain is pathetic at context switch. To learn more about why multitasking is bad, I recommend this blog postand the linked studies at the bottom.

      --
      Jehovah be praised, Oracle was not selected
  2. Sloppy editing indeed by loteck · · Score: 3, Insightful

    "The example code is generally of good quality, but not always consistent; for instance, is employed in some places, but elsewhere — leaving the reader to wonder why."

    What?

  3. What good does an introductory do? by rsilvergun · · Score: 3, Insightful

    there's tonnes of great tutorials online for the major new HTML5 stuff. OTOH, I'd like to see some programming books for HTML5/JavaScript that are bent towards beginners. You can do a lot of cool stuff quick with HTML5 that takes weeks to learn with Java (or months with C/C++).

    --
    Hi! I make Firefox Plug-ins. Check 'em out @ https://addons.mozilla.org/en-US/firefox/addon/youtube-mp3-podcaster/
  4. And lo ! by unity100 · · Score: 3, Insightful

    Moneymaking over 'the new' thing starts. Before even HTML5 specification being completed even. This 'sell books, seminars over any possible shit in i.t.' has gotten out of hand.

  5. hopefully online updates for a couple years by peter303 · · Score: 4

    The really interesting parts of hmtl5, the multimedia capabilities, are in a high state of flux now with more capabilities added every week.

  6. Re:Strange animal by DeathElk · · Score: 5, Funny

    It's the Doe-eyed Blondasaurus.

  7. Re:Strange animal by thedonger · · Score: 3, Funny

    The O'Reilly "Head First" series turned into hardcore porn so gradually I didn't even notice...

    --
    Help fight poverty: Punch a poor person.
  8. Those silly covers by Sarusa · · Score: 4, Funny

    Around here if you ask about a Head First book (some of them aren't bad) everyone looks at you blankly. Ask for the Hot Teen book and it's "Oh!"

    I guess that's successful branding... of a sort?

    But they're embarrassing as hell to be caught with on your desk. "It's about programming! It's a technical book! I swear!"

  9. Re:I don't get it by thedonger · · Score: 3, Informative

    How can there be a book on HTML 5 when it isn't even a finished specification yet? This book is a waste. At any moment the spec can change drastically and render this book useless. I'm sure half of it is just hacks to get it to render the same HTML 5 and CSS3 content across FF, Chrome, IE and Opera since they all have their own versions of HTML5.

    There is enough that won't be changing - conceptually and literally - to warrant a thorough treatment of HTML5; however, I doubt it is worth the cost of this book given the volume of people writing about it for free on the intertubes. And for the truly masochistic, there is always w3c.org, where you can read the entire specification for free.

    As for how browsers interpret the standard, that probably changes faster than the specification itself, so one is better off looking to quirksmode, et al, for how browsers handle various elements of HTML and CSS. Or better yet, just experiment with it.

    --
    Help fight poverty: Punch a poor person.
  10. The best html5 + api overview out there so far. by puppetluva · · Score: 5, Interesting

    I see a lot of naysaying here, and I respectfully disagree. In general, I've been really turned off by the Head First Series (I tend to think the style is annoying), but this book is better than the rest and is probably one of the best high-level overviews of html5+javascript+css3 that I've seen in one book. note: I have nothing to do with the authors or the publisher -- I just liked this one.

    For one thing, this is the book in the series that finally gets the point that Javascript is the heart of web interactivity. It doesn't shy away from plenty of Javascript code and it isn't lazy about asking you to write copious amounts of it. If you are a javascript expert, you probably won't be challenged, but you can skip the rudimentary parts and get to the modern browser features and related apis.

    Secondly it gets you through a lot of topics like location-awareness (including the google maps api), 2d canvas rendering, local storage and a few other topics that aren't usually covered together but make a great overview of the current state of browser capabilities. Its not easy to get that in one place.

    I've tried to get overviews elsewhere -- I have been through a bunch of the oreilly series, online documentation, master class videos etc, and I personally think this is the best basic high-level overview of basic web programming for the browser right now. Is it telling you to use backbone? Is it pushing Coffescript, Dart or the other fringe technologies? No -- just the basics, but it does a good job of it. Its not for everyone, but it is a great choice for folks who want a good, easy-going overview..

    I had to put a good word in, because I really liked this one and I like to encourage good tutoral writing -- something that is increasingly hard to find these days (I'd rather see tutorials than cookbooks, blotchy docs or 1-page quickstarts of copy-paste code with a link to api docs). Tree-killing aside, I even liked that it was printed on paper - it seemed like an old-school workbook and I'm not ashamed to say that I enjoyed scribbling in its puzzles and zipping through its pages over a few days over Thanksgiving week.