Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Book Reviews

Submission + - Head First HTML5 Programming

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

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.

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), "sourth" (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."
Book Reviews

Submission + - Responsive Web Design

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

With more people accessing the Internet using mobile devices than computers, web designers and developers are challenged to make sites that work well on both categories of hardware — or resign themselves to the greater costs and other disadvantages of maintaining two versions of each web site (a mobile-ready version as well as one for much larger screens). Fortunately, recent advances in web technologies are making it easier to build web pages whose contents and their positioning are automatically modified to match the available screen space of the individual user. These techniques are explored in detail in a recent book, Responsive Web Design, written by Ethan Marcotte, a veteran web designer and developer.

This title was published on 7 June 2011, under the ISBN 978-0984442577, by A Book Apart, as the fourth in their series of "brief books for people who make web sites." On the publisher's page, visitors will find brief descriptions of the book and its author, links to purchase the print and e-book versions (or the two combined, at a substantial discount), and three promotional blurbs also used on the back cover of the print version. The e-book package consists of six files: the book in EPUB, MOBI, and PDF formats; an EPUB document on responsive design for video; a letter from Jeffrey Zeldman (the book's publisher), Jason Santa Maria (its designer), and Mandy Brown (its editor); and the previous five files zipped into an archive. This book is also available in French, perhaps reflecting the publisher's greater awareness of internationalization relative to mainstream technical publishing houses.

Readers of the print version will likely be first struck by its diminutive size — just 143 pages. In fact, the book is so slender that only half of the spine title actually fits on the spine. (It's either a bold design statement against conventional publishing practices, or an even bolder typographical error committed inexplicably by a well-regarded design firm.) Flipping through the glossy pages, readers will also notice the judicious use of text color to indicate HTML and CSS code, and highlighted fragments therein. Even more visually impressive are the full-color screen shots and other figures. The book begins with the previously mentioned letter, as well as a short yet delightful foreword by Jeremy Keith; it ends with the author's acknowledgments, suggested resources, references by chapter, and a suspiciously brief index, not much longer than the author bio that follows it.

The bulk of the information is organized into five chapters — the first of which, "Our Responsive Web," presents a high-level rationale for architecting web sites that can be maximally useful on a wide range of devices, with screen sizes ranging from the smallest found on smartphones, up to widescreen TVs attached to web-enabled game consoles. Throughout the book, to illustrate the principles of responsive design, the author utilizes a fictional example web site, "Robot or Not", designed to assist users in identifying robots masquerading as humans (which would have been helpful to the crew of the spaceship Nostromo!). This short chapter is essentially just an introduction.

The author gets down to business in the second chapter, titled "The Flexible Grid," which demonstrates how grid-based layouts can be used to more easily position page elements for greater visual consistency. He goes into detail in showing how such layouts can be made flexible, with font sizes specified in character widths and positioning specified in proportions of containing elements. Experienced designers will probably not encounter any new concepts in this material. These techniques are extended in the subsequent chapter, "Flexible Images," which explains how to use percentages when working with images (both markup and CSS) and other media types — including workarounds for the browser most despised by web designers, Internet Explorer.

Media queries, introduced to the world in CSS2, are now a key technology in responsive design, and are discussed in Chapter 4, which forms the core of the book. The author shows how to use them to cause the browser to apply CSS rules selectively based upon such factors as the width of the browser viewport. All of the narrative is clear, except for the statement on page 66 that the example web site's logo is "scaled down to a nearly microscopic size" in Figure 4.2, when in fact it appears unchanged. Readers may wonder why — after noting that mobile devices do not consistently use "handheld" or "screen" as their media types — the author does not explain why the recommended media queries use "@media screen," and not "@media all" to be more encompassing. Nonetheless, the discussion of media query techniques is instructive. It continues with a look at how to use them in older browsers, using JavaScript libraries, css3-mediaqueries-js and Respond.js. Lastly, the author shows how incorporating some fixed widths into a flexible design may be an optimal approach.

The fifth and final chapter, "Becoming Responsive," discusses real world implications of responsive design. The author counters an interesting contention: web sites on mobile devices should not simply be the desktop content scaled down to a smaller screen, but instead should offer different content, more appropriate for the individual on the go. He then touches on the topic of designing sites first for mobile, rather than the traditional approach of trying to shoehorn a full-size site onto a small screen. The bulk of the chapter is devoted to presenting a workflow employed by the author in creating actual client sites. It concludes with a demonstration of how to add a slideshow using a jQuery plug-in and some custom code, so it abides by the principles of progressive enhancement.

In terms of the physical book, the quality is top-notch, and the full-color images are quite compelling. Sadly, each figure tends to bleed through to the other side of its page, but fortunately not enough to inhibit reading the text on the other side, or appreciating any of the images. The e-books are also quite readable — probably more so compared to the electronic versions of other programming books, given the smaller line lengths.

In terms of the narrative, Ethan Marcotte has a somewhat goofy writing style, replete with nerdy side comments and jokes, which some readers may regard as padding, particularly in those sections where they are quite numerous. The same may be said for the hyperbole in some spots, such as "Marvelous. Wonderful. Stupendous, even." (page 33). On the other hand, many readers may enjoy the lighthearted style, especially those jokes that work well. More importantly, the explanations are generally comprehensible and thorough. I was able to find only one erratum ("or a maybe an animation," on page 119), and the only grammatical error was the frequent use of the term "that" to refer to people, instead of "who." Otherwise, there were no glitches in the writing, and most techies will find this book a fairly quick read.

From a higher-level perspective, one sometimes hears an objection raised against web design/development books such as this one — namely: all of the book's information is freely available in articles, blog posts, forums, IRC channels, and other resources for programmers. So why purchase a static book whose author probably started writing it months if not years in the past? Such technical information is scattered among numerous websites, thereby forcing us to spend time searching around, and in many cases skipping over redundant material. Also, the advice tends to vary in quality, and hence we must distinguish what information is out of date or simply invalid. Likely every experienced developer has been tempted by an article titled such that it sounded as though it would contain the exact solution to the problem at hand — only to discover that the title was quite misleading, or the people contributing to the comments were equally befuddled (and frustrated). Technical books geared toward the working professional can obviate these problems, because they bring together most of the information known by the industry, into a cohesive whole, that is then vetted by technical reviewers and editors. In the case of this monograph, Ethan Marcotte's well-regarded seminal article, in conjunction with the other most popular articles on responsive web design, would still not be a sufficient substitute for this resource.

For web designers and developers alike, Ethan Marcotte's book is a neatly-crafted and authoritative single-source tutorial on how to build responsive web sites that will likely prove robust on a wide range of platforms.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Drupal 7 Themes

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

If you need a theme for a web site based on Drupal 7, then you have a few options for obtaining one. You could go with an existing theme, but the current crop of prebuilt themes is even more limited for Drupal 7 than its predecessor. You could hire a dedicated Drupal themer to create one for you. Or, to avoid the expense, you could try to build your own. In that case, you will need to get up to speed on the changes in the Drupal presentation layer. Unfortunately, most of the Drupal 7 books devote only one or two chapters to the topic. Several Drupal training firms offer video instruction, but the bulk of their material is still geared to version 6, or even 5. The online documentation is of little help. Yet there is a book that is wholly dedicated to the topic: Drupal 7 Themes, authored by Ric Shreves.

This title was released by Packt Publishing on 24 May 2011, under the ISBN 978-1849512763. This review is based on a print version of the book, kindly provided by the publisher. An e-book version — in both the PDF and Mobipocket formats — is available from the publisher's page. Visitors will also find a book description, the table of contents, a sample chapter (the seventh one, "Dynamic Theming"), and, elsewhere on their site, the reported errata (only one at this time). None of the example code presented in the book appears to be downloadable — probably because there is little of it. Like so many Packt Publishing titles, this one is relatively slender compared to other publishers' Drupal books, at 320 pages. The material is organized into ten chapters, as well as an extensive appendix occupying a quarter of the book. The preface notes that the only requisite knowledge is "basic experience of working with Drupal," as well as HTML, CSS, and, optionally, some basic knowledge of PHP. This book is a revised and expanded edition of his previous book, Drupal 6 Themes.

The first chapter provides an overview of the basic concepts of Drupal theming, including its purpose, its customization capabilities, the intercept/override paradigm, sub-themes, some online resources, theme engines, theming output, front-end versus admin themes, the default Drupal 7 themes, and theme files. It is a decent introduction, but would likely be more helpful to theming newbies if the basic concepts — such as what themes are — were discussed prior to more advanced topics — such as intercepting and overriding. All of the material is clear, except for the reference on page 21 to "the Add Shortcut icon," which is not identified or apparently even present in the referenced screenshot. Chapter 2 covers the basics of the configuration settings for themes (global and specific), blocks, and regions, as well as how to install and uninstall themes. It can be safely skipped by anyone familiar with administering a Drupal site.

PHPTemplate has become the de facto templating engine in Drupal, and is introduced in the third chapter. The author focuses on the key files that compose a Drupal theme, and for illustrative purposes uses two themes built into Drupal 7: Seven and Bartik. The author of the latter, Jen Simmons, a female web designer, is oddly referenced in the masculine (page 80). The subsequent chapter gets off to a poor start with nine paragraphs that essentially state the same thing, over and over. But it eventually delves into the critical topics of default templates, themeable functions, individual styles, and whole stylesheets, as well as how they can be overridden using custom CSS and PHP code, including template preprocessing functions. The theory is later illustrated with a focused examination of Bartik. It is with this material that the author begins digging into the technical details of how custom Drupal theming is accomplished.

Chapter 5, "Customizing an Existing Theme," demonstrates how to create a sub-theme, in order to leverage the functionality of a base theme. Readers may be confused as to why the author chose to not present his list of recommended base themes, until the next chapter. After all, readers presumably would want to know the optimal candidates for starter themes while first learning how to select and use them. This confusion could have been avoided had the author explained that those are not just base themes, but starter themes. More importantly, the narrative contains a technical error: On page 115, readers are told that "This is a requirement for a valid sub-theme; you need at least one stylesheet." Testing shows that assertion to be untrue; only a .info file is required. Four pages later, readers are told to refresh Drupal's cached registry to see changes to the template files and theme functions, which contradicts the tip on page 94 that such refreshes are only needed when theme functions or templates are added or removed, but not if they are changed. Aside from these blemishes, the material presented is more than adequate to help get readers started with sub-theming.

Some readers will likely be disappointed that the first half of Chapter 6 discusses how to build a theme using a base theme — the previous chapter's topic — except instead of Bartik as the base theme, a more basic starter theme, Fusion, is used. Aside from that, it's the same process, and large chunks of the text are duplicated — even the erroneous claim of a stylesheet being required (page 130). Finally, the reader arrives at the second half of the chapter, which explains how to create a new theme from scratch. Other sections of the book are referenced heavily, which is possible because the first five chapters have set the stage for this topic.

With Chapter 7, the author takes the earlier introductions to theme templates, and explores them in much greater detail, showing how to separately theme specific groups of pages, including a site's homepage, as well as regions, blocks, and specific elements on a page. The author states (page 158) that all the theming baseline variables are documented inside of the page.tpl.php file, but that only seems to be true for the Bartik and Zen themes. Also, the concept of a block delta is not adequately explained or illustrated. Otherwise, this chapter provides more content and less repetition than most of the others. It concludes with a discussion of CSS classes dynamically generated by Drupal.

Traditionally, one of the most problematic areas of web design is the styling of forms — the focus of Chapter 8. The forms that are built into Drupal by default — user, search, poll, and administration — are presented from a functional standpoint. It is then shown how they can be modified using half a dozen techniques, with varying levels of control over the output and the amount of complexity in achieving that control. The next chapter looks more broadly at other difficult aspects of Drupal theming — including cross-browser compatibility, accessibility, validation, theming the output of various core modules, and many more topics. Some of the tips provided could be quite valuable if and when the reader is stymied by one such problem or another. The final chapter, "Useful Extensions for Themers," introduces a number of helpful tools, most of which are contributed modules. The book concludes with a lengthy and detailed appendix that lists the files, paths, and descriptions for all of the theming system-wide functions and mostly the core module-specific templates.

The author's writing style is conversational, with generally comprehensible explanations. But there are a few baffling phrases, such as "displayed in courtesy of a conditional statement" (page 70); and the common phrase "you likely need to" is twisted into "you are likely needed to" (page 119), which actually has a different meaning. All sorts of phrases are set in title case, without reason, such as "Dev Server" (page 111). Something else that may be difficult to fathom, is that the book's code does not reflect the fact that Drupal.org transitioned from CVS to Git for version control, in February 2011, three months before publication of Drupal 7 Themes.

There is a fair amount of redundant information, even on the same page — such as the theme settings instructions, in duplicate on page 36, and partly repeated again on the next page. Each chapter concludes with a summary, which in most cases is of no benefit to the reader, given how short most of the chapters are. Far too much of the text is presented in bracketed and indented warnings and tips. For instance, page 180 has no fewer than four such blocks of text, and they take up most of the page. In fact, there are several places where a paragraph of the main narrative is inexplicably turned into a warning, indented with large brackets (e.g., pages 71 and 95).

Punctuation is another area where this book could be improved. Most computer programmers use far too few commas in their writing, but this book demonstrates the opposite problem in several places, such as twice on page 71. On the other hand, there are places where a comma could have made the narrative more clear upon first reading. Fortunately, this problem is not nearly as prevalent as seen in the preface, which appears to have been written by someone whose first language is not English. As with most books written by techies, this one contains too many exclamation marks — invariably an indication that the author is trying to make a dull subject seem more exciting. Fortunately, most of this is limited to the early material, and dissipates as the author settles into the important topics. Lastly, there are many spots where the wrong punctuation symbol is used, e.g., a comma trying to perform the duties of a semicolon.

Seemingly every Packt title contains a long list of errata, and this one is no exception: "focuses is on" (page 2), "you Drupal 7 site" (2), "Indentifying" (2), "access to [a] Drupal 7 installation" (3), "Addition[al] tools" (3), "function [of] Drupal themes" (11), "an as" (24; should read "as an"), "Supports [a] four-column area" (24), "all/ themes" (30), "those global setting[s]" (40), "<none>" (49; should read "- None -"), "jump[ ]start" (56), "a temporary CSS files" (87), "in [the] last style sheet" (89), "go ahead [and] make" (100), "Why it is" (113; should read "Why is it"), "functionbartik_menu_tree" and "functionjeanb_menu_tree" (123; similar mistakes are seen on pages 181, 189, and 195), "be name[d]" (124), "cssto" (130), "theadvantages" (147), "is it" (151; should read "it is"), and "different appearance[s]" (153). At this point, roughly halfway through the book, I stopped recording errata. Packt Publishing's copyeditors should have spotted and fixed these problems, as well as those scattered throughout the rest of the manuscript.

Yet the major weakness of this book is the extensive repetition of material — ranging from the paragraph level (one paragraph repeating information from earlier, nearby ones) to the chapter level (e.g., Chapter 6's wholesale copy-and-paste of material from the previous chapter). Also, the book would have been more current if it addressed the critical web design topics of responsive design, media queries, and how they can be employed in Drupal theming. But it is possible that constraints of space and available time for this project, prevented the inclusion of these advanced topics.

Aside from these problems, and those mentioned earlier, this book does a fine job of explaining the key concepts, and demonstrating them in sample code. Drupal 7 Themes is possibly the best available resource for anyone who wants to learn how Drupal themes work, and how to build custom themes.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Definitive Guide to Drupal 7

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

Most computer and web programming books are written entirely by a single author, while the remaining are written by more authors, typically with each one tackling several chapters. The latter approach can suffer from redundant material undetected by editors, and inconsistency in the writing style from one chapter to the next. Yet it offers the significant advantage that the subject matter of each chapter can be presented by an authority on that topic — who can focus on making that explication the best possible, without the burden of completing an entire book. That was one of my first thoughts (and hopes) when hefting the 1112 pages and 4.1 pounds of the Definitive Guide to Drupal 7.

This tome was published on 19 July 2011, under the ISBN 978-1430231356, by Apress (who kindly provided a review copy). As of this writing, it appears to be the longest Drupal book in existence — more than 400 pages longer than the nearest two contenders. Fortunately, no single author ended up in an insane asylum as a consequence of trying to write such an extensive work on his own. Rather, this book is largely due to the efforts of 34 writers in total — more specifically, 30 authors (listed on the front cover, roughly in descending order of how many of the pages they wrote) and four more contributors (added to the list on the title page). This may be a new record in technical book publishing. The entire authorial crew won't be listed here, but it should be mentioned that Benjamin Melançon was the lead author, and contributed to many of the chapters.

The book's material is organized into 38 chapters and nine appendices — all grouped into eight parts: Getting Started, Site Building Foundations, Making Your Life Easier, Front-End Development, Back-End Development, Advanced Site-Building Topics, Drupal Community, and Appendix. The chapter and appendix titles won't be listed here, but can be found on the publisher's book page, which also offers a description of the book, a section for reported errata (none as of this writing), links to purchase the print and electronic versions of the book, and a downloadable archive of the source code. Unfortunately, the code is apparently available only as a Git repository, and thus is inaccessible if you cannot — or do not want to — install Git on your computer. Consequently, it would be more difficult for such a reader to follow along and implement the example code while reading the book.

The authors have created their own website for the book, where visitors can sign up for e-mail notification of updates and free chapters, view a chapter outline (which features some bonus material), see author photos and bios, offer suggested changes for future editions, and learn of reported errata (three, at this time). Throughout the book, readers are told to access that site for additional information related to the chapters' topics; yet there does not appear to be any such information, even after registering a new account and logging in. This will be most disappointing in those cases where the reader is enticed by the promise of valuable information, only to find that it is absent. The authors state (page lv) that there are forums, one per chapter; but those do not yet exist. In general, there seems to be a huge disconnect between that website and the claims made in the book as to what extra material readers will find there.

The book begins with some introductory material, consisting of three mini-chapters: "What's New in Drupal 7" briefly describes some of the terrific improvements over version 6. "How to Use the Book" reassures the prospective reader that the book "does not presume any specific prior curriculum", although this seems inconsistent with the back cover's user level of "Intermediate-Advanced". Also, readers may be perplexed by the claim that the URL path admin/people/permissions/rules will go to admin/help (page lv). The last section, "How Drupal Works", oddly does not explain how Drupal works, but instead discusses some common terms and the typical phases of a website development project.

The first part of the book comprises two chapters, the first of which has the promising title of "Building a Drupal 7 Site", and provides a cursory summary of site planning, wireframing, Drupal installation, the Administration menu, the Shortcut toolbar, color schemes, and modules. The chapter continues with sections on content types, blocks, taxonomy, and other key concepts — all grouped under the chapter head "Allowing People to Register and Log in with OpenID", even though those topics are unrelated to OpenID. All of the chapter's topics are illustrated by stepping the reader through building, from scratch, the beginnings of the Drupal 7 website — namely, one similar to the authors' site mentioned earlier. Unfortunately, some of the instruction in the book does not match the actual website design, e.g., no introductory text (page 20). Readers may be amused by the tip on page 11, which refers to "the remaining 800 pages of the book". Perhaps the remaining 1101 pages can be chalked up to scope creep! The second chapter explains the basics of how to install and use Drush and Git, but not for Windows users. Readers should find the material instructive and consistent, except for the claim that Git is "easy(ish)" even though "getting the hang of Git [is] a lifelong learning process".

The half dozen chapters that compose Part II first introduce some of the most commonly-used Drupal modules, with extensive coverage of Views and later Organic Groups. A couple chapters explain how to keep one's site secure, partly by updating Drupal core and modules. The last chapter continues the development of the example site, using modules presented earlier. All of these chapters' narrative is valuable, although a couple pronouncements are too severe (e.g., "User input is evil", on page 127); but overall the advice is well warranted. Yet the chapter that will most likely aggravate readers is the eighth one. It seems to presume that the reader's test site was not affected by the exercises of the previous chapters, such as the Organic Groups. Secondly, some key information is incorrect, e.g., "Content: Image" (page 159) should be "Content: Headshot". Lastly, the authors refer to items not yet created as though they were, e.g., a "Table of Contents" menu link, an "Outline of Chapters" menu, and a "Twitter" field (pages 162-164). Unfortunately, the effects of all these problems compound, and, combined with the changes in Views since Drupal 7.0, make it increasingly difficult to follow along and implement the instructions.

Part III offers another half dozen chapters, in this case devoted to higher-level, less technical matters — specifically, how to: best participate in the Drupal community, plan and manage a Drupal-based project, craft effective documentation for your sites' end users and support staff, set up a workable Drupal development environment, launch and back up a new website, and stay sane while doing all of this. The information presented is worthwhile, with only a couple peculiarities: Firstly, why is the book organized so that some technical information is presented in the early chapters, as well as later chapters, while a group of "softer" topics are sandwiched in between? Secondly, for Chapter 12, why is the reader told, halfway through the chapter, that she will need "A computer able to connect to the Internet" and "An Internet connection" (page 233)? No one who has worked through the preceding dozen chapters needs to be reminded of this. Perhaps this chapter, on how to set up a development environment, should be made an appendix, as was the other installation and setup topics (Appendices F-I).

The next few chapters, Part IV, explore front-end development — namely, theming and jQuery. The first two chapters were penned by Jacine Luisi, who heads up the HTML5 initiative for Drupal 8. Readers learn about Drupal's core themes, theme engines, theme administration, metadata files, regions, layout, template files, global template variables, theme functions and hooks, preprocess and process functions, render arrays, theming forms, and more. The discussion is competent and thorough, as well as comprehensible, aside from the repeated use of the verb "print" to apparently mean "display". Chapter 17 demonstrates the use of JavaScript and jQuery in Drupal, and finishes by showing how to use jQuery UI to implement animations, such as accordions and progress bars.

Part V, "Back-End Development", comprises seven chapters that explain how to develop custom Drupal modules using the APIs. Because they provide an introduction to Drupal's system of hooks and overrides, they probably should have been located before the earlier chapters on theming, which rely upon those features of Drupal. Regardless, Chapters 18-20, by Benjamin Melançon, attempt to demystify the key topics in module development. Because this subject area is so critical to real-world Drupal development, and because the concepts can be quite intimidating to neophytes, any presentation of it must proceed at a reasonable pace, with clear explanation of how each aspect relates to the next. Like similar discussions in other Drupal books, this one begins quite approachable, but becomes more daunting, with a few places where readers will likely be perplexed — such as the hook_form_alter() discussion (page 411), which doesn't seem to match the resultant HTML. Yet this is such a challenging subject area that entire books have been devoted to it, and this one ventures into areas untouched by other books, such as how to create new database tables. Drupal coding standards are presented, although apparently not always followed in the example code (e.g., preceding internal function names with underscores). Part V is rounded out with chapters on porting modules to Drupal 7, writing "glue" modules, performing functional testing, and writing extendable/API modules.

Part VI, "Advanced Site-Building Topics", consists of ten chapters covering a variety of topics: building an online store using Commerce module (authored by the project's founder and lead, Ryan Szrama); Drush (which overlaps with Chapter 2); caching and storage mechanisms (MySQL and MongoDB); RDFa and the Semantic Web; Drupal's routing system; Drupal's internal operations for presenting a requested page; Solr module; UX enhancements in Drupal 7; completing the book's website; and Drupal distributions. All of the information and guidance appears correct, except for a couple problems: The instructions (page 568) to install Commerce Physical Product module, which does not have a Drupal 7 release, as of this writing, and certainly as of the book's publication date. Drune is a music player used as an example throughout Chapter 34, but its website, drune.org (pages 805 and 817), appears to be dead at this time.

Throughout this book, one will find a strong sense of community, with frequent encouragement for the reader to participate and contribute. This is evidenced by Part VII, which comprises four chapters that present: Drupal's history, how to make a living as a Drupal developer, how to maintain a contributed project, and further thoughts on how to contribute to the overall Drupal community. The book concludes with Part VIII, consisting of nine appendices, most of which focus on how to install Drupal on various platforms. This part is strangely titled "Appendix", yet contains multiple appendices (more scope creep?).

Given the somewhat stunning length of this book, its multitude of authors, and its wide coverage of most aspects of Drupal, it should be expected that the book has both strengths and weaknesses. Consider first that latter category. The authors and publisher should have sought ways to reduce the length of the book. For instance, the overview of PHP in Chapter 18 is not needed for this book's audience, and could be replaced by references to outside, more-detailed resources. The same is true of the section on Drupal coding standards. The book does not need to be made any longer than it already is, without good reason. Speaking of which, most of the longer chapters end with summaries, which are not worth the extra space taken up. Drupal's hook system is explained in at least three different chapters, and Git in two. The many authors should have been aware of this, had they been referencing the book's website, which was presumably built before the text describing it was written. Furthermore, the publisher and its chosen technical reviewers should have also spotted this.

The remarkably large number of authors is probably the primary reason for the book's noticeable unevenness, from one chapter to the next, in the quality of the writing — including the clarity of the explanations, which is arguably the most important factor. In a book written by advanced Drupal developers, it is to be expected that they will use Drupal-specific terminology. That is fine, but such terms should be defined at least once, before encountered by any readers unfamiliar with them. For instance, page xxxv alone mentions "d.o", "D8", and "contrib" — all meaningless to someone learning Drupal. There are places in the text where the descriptions do not match the corresponding screenshots (e.g., the "Required field" on page 18), and where, in the narrative, the lack of quotation marks around field labels makes it jarring and difficult to understand (e.g., throughout Chapter 8). There are some inconsistencies in spelling (e.g., "web site" and "website", even in the same sentence, on page lii), some inconsistencies in italicizing menu links (e.g., page 13), some misused phrases (e.g., "cannot be understated", on pages lix and 225, when "cannot be overstated" was called for), some baffling allusions (e.g., "aiee-the-alligator-is-going-to-get-me", on page 492), curly quotes in the code (e.g., pages 277 and 356-9), a repeated paragraph (page 507), an oxymoron ("libertarian communism"; xlvi), and the obligatory conflation of "depreciated" and "deprecated" (page 495) found in countless programming books.

This book contains numerous errata: "co-maintainer [f]or Drupal 7" (page xxxiv), "and." (xxxv), "bi-lingual" (xxxviii), "able [to] handle" (xlix), "don' think" (lv), "criteria[:] type" (lviii), "able [to] fill" (11), "th[r]ough the" (14), "an a" (19), "ask question questions" (29), "install [the] X-ray" (38), "You [] requests nuggets" (49), "you want to you" (56), "on [the] system" (57), "menu of option[s]" (57), "Rather [than] saving" (57), "menu(" (58), "you[r] Views" (59), "These setting[s]" (61), "that what" (66; should read "than what"), "might for use" (67), "you would chose" (67), "the next sort criteria" (67; should read "the next sort criterion"), "by click[ing]" (74), "you are make" (85), and "have [to] click" (85). At this point, not even 8% of the way in, I stopped recording them — although an amusing one is worth mentioning: "gather shook information" (452). Lastly, how did "Drurpal.org" (854) make it past the spelling check? It turns out that the entire book is peppered with such errors, and that first batch was merely the beginning. It is difficult to believe that so many obvious errata could have made it through any professional copyediting process.

Readers who are following along, and likely using the latest version of Drupal (7.8 as of this writing), will notice some differences between what they see on their screens and what is shown in the book's screenshots — most if not all of which are based upon Drupal 7.0. This is especially noticeable in Chapter 3, which covers Views, a module affected by ongoing enhancement. For instance, Views exporter submodule (page 52) is now gone; "Access all views" (page 53) has been altered; "Display Status" (page 62) is gone; there are no broken link icons to indicate overrides; "views/edit" (in the URL, page 71) is now "views/view"; and the Fields configuration dialog (page 75) is different. Fortunately, none of these cases of obsolescence should have any impact on the value of the information as a whole.

On the positive side of the ledger, this book offers much to be commended. As with any worthwhile programming book, this one makes extensive use of code snippets and screenshots to illustrate concepts discussed. These appear to be correct, except in the flowchart of Figure 30-3, where the conditional symbol's arrows are missing values. The text contains some welcome humor (e.g., a kittens photo request, on page 43) and some apt phrases (e.g., Permission module's "wall of checkboxes", on page 156). Some of the chapters were written by the contrib module developers/maintainers, i.e., those who arguably know those modules best. This is unique among the growing list of Drupal books, in that it devotes entire chapters to topics neglected by its competitors — such as documentation, installation profiles, module porting, Drush, Git, and working profitably as a Drupal professional. Some of this information emphasizes the value of project management (both for your individual projects, and Drupal as a whole).

On balance, the pluses outweigh the minuses. The book has a lot of good information, and many of the problems stem from sloppy writing that should have been caught by the publisher's editing team. It may not be the best source for some key subject areas, such as security or site building options. But if you seek a sole source that offers more information in total, then this is your book. For some topics — such as upgrading Drupal, crafting and testing modules, building installation profiles, and the inner secrets of the menu system — it goes into far more detail than any other. Definitive Guide to Drupal 7 is an impressive attempt to be just that, and no other single book currently matches it.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - CoffeeScript: Accelerated JavaScript Development

coder4hire writes: "Robert: Please change the attribution from "coder4hire" to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

For decades, programmers have written computer code in one language, and then programmatically translated that code into another, lower-level form (typically machine code that can be run directly by a microprocessor, or some sort of bytecode that can be interpreted by a virtual machine). For instance, source code written in C or C++ is compiled and assembled into machine code. In web programming, there are emerging languages and other tools for translating code into JavaScript. For instance, Google Web Toolkit allows the programmer to create web apps in Java. The latest addition to this category is CoffeeScript, a language that can be compiled into JavaScript, and is intended to reduce source code size and clutter by incorporating some of the best operators from other Web scripting languages, particularly Ruby. It is also the topic of a new tutorial, CoffeeScript: Accelerated JavaScript Development.

This book is authored by Trevor Burnham, who is credited as one of the early contributors to the project by Jeremy Ashkenas (the creator and project lead of CoffeeScript) in his foreword to the book. Published by Pragmatic Bookshelf on 3 August 2011, under the ISBN 978-1934356784, CoffeeScript: Accelerated JavaScript Development fills only 138 pages, which is certainly a change of pace from the majority of programming tomes now being released. This book's material is grouped into six chapters, plus four appendices — aside from a preface, which introduces CoffeeScript as well as a word game, which is used as the example project throughout the book. Oddly enough, the preface mentions jQuery, but not as one of the well-known attempts to streamline JavaScript code.

The first chapter, "Getting Started," begins by briefly explaining how to install Node and npm (Node Package Manager). These instructions assume that you are following along in a Linux environment or some emulation thereof. They also seem to assume that nothing goes wrong in any of the steps, because no troubleshooting guidance or references are provided. Given the number of moving parts required to get CoffeeScript running, as well as the technical pitfalls that could ensnare a Windows or Mac user, the author should have provided more clear and detailed installation instructions. Also, readers unfamiliar with Linux/Unix may be puzzled by some of the instructions. For instance, page 3 appears to state that the way to check that those two aforesaid packages are on your path, is to simply type in "PATH" (whereas what is needed is "echo $PATH"). From that point forward, the narrative gradually becomes more opaque, with cursory coverage of text editor plug-ins, the "coffee" command line compiler, REPL, "the soak" (an existential chain operator), and the limitations of trying to debug CoffeeScript code. It is quite possible that by the end of this chapter, many readers will decide to not bother trying to learn CoffeeScript, and instead to stick with plain JavaScript, possibly supplemented with jQuery (which is not to say that jQuery code is any easier to read).

In the next three chapters, the author presents the basics of CoffeeScript, including how to: define and use functions and their arguments; test conditionals; throw and catch exceptions; understand variable scoping and context; create arrays using splats; accept input from the console; create objects, arrays, and soaks (in more detail than before); iterate over collections; match patterns; define namespaces using modules; and create prototypes and classes. He makes extensive use of examples, which thankfully are concise (unlike some programming books whose example code span far too many lines, and sometimes even multiple pages — forcing the reader to dig through the code, trying to find the important lines). Also, the brevity of CoffeeScript syntax is undoubtedly a factor. However, his concise style extends to the narrative as well, and will likely cause newbies to have to read the material several times — and even then wonder whether they fully grasp the concepts. It seems that the author understands CoffeeScript extremely well, but is not always able to communicate that knowledge to the reader in a patient and comprehensible manner.

Chapter 5 is a primer on jQuery, and is apparently included in the book so that the example application (the word game) can be made to work in a web browser — since none of the code or narrative (aside from the example app) appears to be related to CoffeeScript. It would have been more efficient to simply point the reader to an online jQuery tutorial, and then present only the CoffeeScript-specific differences — or just briefly explain how to load CoffeeScript files in an HTML file, which could have been done in a sidebar. The last chapter demonstrates how to run CoffeeScript on a web server, utilizing Node.js, and also explores how the lack of threads in JavaScript can impact Node programming. The example project is made multiplayer using Node, Connect, and WebSocket.

The appendices provide answers to the end-of-chapter exercises, alternative methods of running CoffeeScript code, a JavaScript cheat sheet, and a list of a half dozen bibliographic references. This book concludes with a suspiciously-short index, at less than three pages long, which appears to provide only the first or earliest occurrences of the major terms. Consequently, anyone who tries to use this book as a reference work for looking up key terms quickly — or for finding their later occurrences — will likely need to obtain an electronic version of the book, since all e-readers have search functionality. Furthermore, the index is missing some key terms used in the text, such as "function callbacks" and "arbitrary expressions" — heck, it's even missing "expressions," a fundamental concept in any programming language.

Prospective readers who wish to learn more about the book, can visit Pragmatic Bookshelf's page, which offers brief descriptions of the book and its author — as does O'Reilly Media's page. But, as of this writing, only the former makes available an e-book version, pre-publication reader comments, a discussion forum, the example source code used in the book, and a link to a page for reporting errata, which already has more than half a dozen items listed. More are present in the text: "add [a] multiplayer capability" (page xx); a lone ")" missing its matching "(" (in Exercise 6, page 34); "in a lot in functions" (page 107; should read "in a lot of functions"); "a[n] overhead" (page 110); "everyone and their dog is" (page 116).

The author's writing style is sometimes quirky, which in most cases adds a bit of levity, but occasionally leads to the misuse of terms, e.g., array ranges usage described as "fantastical" (page 43). "BDFL" (page xiii) will prove puzzling at first to most readers. On page xvi, the reader is told that JavaScript "contains multitudes." — multitudes of what? And nothing can excuse the groan-inducing "automagically" (page 100).

In terms of the ordering of the topics, one of the most exasperating aspects of this book is the way that many language concepts — such as chained comparisons, and variables being true or false (or "truthy" or "falsy") — are not presented up front, on their own, but mixed in with discussions of other topics, including development of the game application, and even in the answers to the chapter questions (Appendix 1). This makes the book generally unsuitable as a reference, especially when combined with a disappointing index.

One might assume that the modest size of this book is a result of the small size of the language itself. But another factor is surely the pithy presentation style for even some of the most important concepts in the language. Perhaps worst of all — especially from the perspective of someone relatively new to programming — some basic concepts are not addressed, or the example code does not address common use cases. For instance, in CoffeeScript, how does one create a block consisting of multiple lines of code? On page 17, indentation is briefly mentioned, but the sample code shows single-line blocks only. Other important ideas are "saved as an exercise" (which may induce flashbacks to exasperating technical college textbooks). Some readers may conclude that the author didn't want to make the effort of fully describing the language, in a more canonical fashion, which would have resulted in a much longer, but more valuable book.

It is unclear as to how much of the likely mystification and frustration of the average reader will be due to the writing choices made by the author, and how much can be blamed on the sometimes cryptic syntax of CoffeeScript, evident in the discussion of topics such as function binding (Chapter 2) and keywords (e.g., from page 106, "what.x and @x are, of course, equivalent if and only if what is this." Of course!). Readers are told in the introduction that they do not need to be experts in JavaScript to understand the book's material, and can be amateurs (page xviii). But there are several places in the book where intermediate-level knowledge, at a minimum, would be needed. That sort of difficult material may be another point in the CoffeeScript journey where some readers will decide to eschew learning the language.

The production quality of the book is fine, except that the chosen font's ratio of height to width is more than what is usually found in books nowadays; when combined with inadequate spacing among the words within many of the sentences, it makes it difficult for the reader to rapidly scan the material. The e-book version reflects the same minor problem. Yet it makes excellent use of color for syntactically highlighting the code — a feature not seen in the print version.

So if you would like to do some JavaScript programming, but without writing any JavaScript, then one possible place to start your journey is CoffeeScript: Accelerated JavaScript Development. As of this writing, it is the only CoffeeScript book on the market. Yet should the language continue growing in popularity, then more substantial and recommendable books will probably become available.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - Build Mobile Websites and Apps for Smart Devices

coder4hire writes: "Robert, please set the attribution to "Michael J. Ross", linked to http://www.ross.ws/. Thanks!

With the proliferation of handheld devices that allow access to the Web, more business owners and other technology decision-makers are demanding that their organizations' websites be fully accessible on those devices, and even be repackaged as new web-based applications. But designers and developers who may be quite proficient in making non-mobile websites and web apps, can feel uncertain as to how to craft those products, or even where to start the process of learning how to do so. Recently, several books have been published to address this need, including Build Mobile Websites and Apps for Smart Devices, authored by Earle Castledine, Myles Eftos, and Max Wheeler.

This title was published by SitePoint on 29 June 2011, under the ISBN 978-0987090843. The book's contents span 300 pages, and are organized into a preface, eight chapters, an appendix, and an index. The preface contains the usual meta information about a technical book; but what really shines is its intro section, which enthusiastically entices the reader to jump into the burgeoning field of mobile web development. The appendix, comprising little more than two pages, presents only the most basic information on how to utilize whatever native web server might be running on the reader's Linux, OS X, or Windows Vista/7 machine. The more than 49 percent of computer owners still using Windows XP (as of this writing), will need to look elsewhere for information on installing and configuring Apache, IIS, or some other web server, should they want to test their apps locally. In terms of prerequisites for this book, readers are expected to be proficient in HTML, CSS, and JavaScript, but not necessarily HTML5 and CSS3, whose concepts are explained as needed throughout the text.

The publisher maintains a web page for the book, where visitors can find the table of contents, errata (none as of this writing), the book's index, and three free sample chapters (Chapters 1, 2, and 4) in PDF format. Visitors can order the print version of the book, the electronic version (in three different formats: PDF, EPUB, and MOBI), and an online course hosted by Learnable (comprising lessons, video tutorials, Q&A sessions, and the example code).

The first chapter introduces the basic concepts and rationale of mobile apps, as well as some of the key decisions one will face in creating them, such as whether to make a web app versus a native app, and the options for providing a mobile experience. The authors briefly describe the example app — a tool for recording and sharing celebrity sightings — which is designed and created sequentially in the material that follows. But the chapter does not fulfill the promise made for it in the preface, where the reader is told he will "be guided through the process of designing and building a mobile web application"; on the contrary, the chapter does not explain how to design and build one.

That effort begins in the second chapter, where the authors discuss some high-level considerations for designing the user interfaces of mobile devices, as well as the benefits and drawbacks of various navigation and content structuring options. The bulk of the narrative involves wireframing the design for the example app, selecting colors and fonts, and crafting an appropriate icon for it. Readers learn of the advantages of using relative units in their CSS, but not how to get all the elements positioned properly regardless of the target device's resolution, when mixing relative units for text and pixel units for images. The section "Scalable Images," later in the subsequent chapter, is a start, but is not sufficient for non-SVG images.

Chapter 3, "Markup for Mobile," is the longest of them all, primarily because it presents much if not all of the source code written by the authors for the initial version of their example app. The majority of the code is in HTML and CSS, with a focus upon the effects made possible using HTML5 and CSS3. Also discussed are the resource limitations of typical mobile devices, content and menu display options, image techniques and scalability, viewport meta element settings, icons, multimedia, and more. Oddly, on pages 71-72, the resource limitations of iOS are repeated, with only slightly different wording. How could the proofreaders have missed this glaring redundancy?

The fourth chapter, "Mobile Web Apps," addresses the logical next step: enhancing a mobile website so it can function as a web app — for which JavaScript is used extensively. After briefly mentioning a couple of the better-known mobile development frameworks, the authors select jQuery as a library for working with the DOM, to speed development and make the example code more platform neutral. There follows an interesting discussion of touch events on mobile devices, how they compare to mouse events, and techniques for best handling them. But the main goal is to show how to load, swap, and go back to pages so as to most closely simulate the snappy behavior of native apps. The extensive code and narrative in this chapter are the most complex of any in the book, and thus will likely be the most challenging for any reader who is not adept with JavaScript and/or jQuery, or who does not have the patience to work through the example code.

At first glance, it would appear that native apps have a huge advantage over web apps, in that they can access information from their mobile devices' capabilities — such as accelerometers and cameras — historically unavailable to mobile web browsers. Fortunately, an increasing number of standard interfaces are allowing web apps to access that data — and this is the topic of the fifth chapter. The reader is shown how to capture and utilize geolocation data, device rotation and acceleration, as well as shake and touch gestures. The chapter concludes with coverage of how to use HTML5 Offline Web Applications API for enabling an app to work when no network access is available. The subsequent chapter, "Polishing up Our App," shows the reader how to do just that — specifically, preventing the navigation header from scrolling off the screen, handling click processing delays, displaying dialog boxes, storing data on the client device, and other differences. The narrative is clear, except for a perplexing ornithological expression, "Duck-type" (page 182). Experienced developers will appreciate the section on mobile coding best practices, based on controllers and custom events — for minimizing programming headaches as a project's code becomes sizable.

The last two chapters explain how to convert a web app into a native app, using PhoneGap, an HTML5 application platform that allows a Web app to access those resources of the mobile device that would otherwise be unavailable, such as data in the filesystem and images from any built-in camera. Before demonstrating the details of how to implement those capabilities, the authors show how to install the development environments for all of the supported platforms (including Apple iOS and Google Android), and then PhoneGap itself. Lastly, readers learn how to try to monetize their finished web apps by uploading them to the various app stores.

The authors make extensive use of example source code, to illustrate the ideas being discussed, which works well, partly because the code is generally explained clearly and commented as needed. A code archive is available containing the source code used in the book, except that of the first two chapters and the last two, which collectively is minimal. (Look for the "Downloads" button on that GitHub page to avoid having to download all the files separately.) Beware that some of the sample code appears to be incorrect or incomplete, e.g., stars.html in the directories "ch3" and "ch4" appear to be unstyled, and "javascripts/ch3/untitled file" is empty. Readers who elect to type in any code directly from the book, should watch out for "curly quotes" (e.g., page 230), and instead substitute the corresponding straight equivalents.

In terms of the physical presentation of the book, at 9.9 x 8 inches, it is taller and wider than the standard nowadays, allowing for what appears to be a relatively larger font, which makes the text more readable. The attractive color figures are a welcome change from the usual black-and-white screenshots found in most computer books. They enhance the overall appearance of the book's interior and the experience of reading the narrative.

Speaking of which, most of the narrative is quite clear. However, one critical topic for mobile design is screen resolution, including how to best defensively account for that in one's design and coding. This book's coverage of the topic is divided into at least two different places (pages 40 and 55), and should have been consolidated, in the third chapter. Unlike most programming books littered with chapter summaries, this one appears to have only one section with a summary, which oddly does not summarize the information presented in the section, but instead offers some interpretation thereof. Also, American readers might stumble over a few of the words that use the English/Australian spelling, e.g., "licence" (page 239).

Some of the phrasing will likely befuddle the majority of readers, especially in cases where the authors fail to define their terms, e.g., the first bullet point on page 47. There are a few minor inconsistencies in the writing, such as "fill out forms" and "fill in a form" (on the same page, 32), but nothing that would cause confusion on the reader's part. The overall writing style is friendly, although sometimes overdone with an excessive use of exclamation marks (e.g., page 40). The text contains some errata (including several that suggest that the SitePoint copyeditors are unfamiliar with the ability of even a common word processor such as Microsoft Word to detect duplicate words): "to thank to" (page xxi), "the the" (pages 8 and 84), "for for" (13), "look at [in] Chapter 6" (34), "let[']s break" (44), ", (" (54 and 142), "no way to we can used" (55), "[up] to this point" (82), "try and" (82, 93, 131, and 167; should read "try to"), "support [for] standalone mode" (89), "are are" (139), "it's" (162; should read "its"), "if there are" (172; should read "if there were"), "ultimately .depend" (196), "On[c]e you've installed" (203), "we're yet" (212; should read "we've yet"), "an an" (225), "more detail that" (238; should read "more detail than"), and "a a" (240).

Yet none of the aforementioned problems are of great significance, and do not detract from the value of the material presented. All three authors have extensive experience in designing and developing mobile web applications, and this is reflected in the authority with which they not only offer the technical details, but also make recommendations to the reader. This book would serve as an excellent starting point for any web programmer who wishes to learn how to create mobile web sites and applications.

Michael J. Ross is a freelance web developer and writer."
Book Reviews

Submission + - JavaScript: The Definitive Guide, 6th Edition

coder4hire writes: "Released during the early days of the Web, in 1995, JavaScript has come a long way: Initially a client-side scripting language typically (mis)used for decorative effects, it is now an essential part of countless major websites. Its increasing capabilities and popularity are due to several factors, including the development of libraries that resolve earlier stumbling blocks that held the language back (such as inconsistencies among the implementations in different vendors' browsers). JavaScript: The Definitive Guide, authored by David Flanagan, was first published just one year later, in 1996, with several significant updates made since then.

The book is now in its sixth edition, under the ISBN 978-0596805524, and was published on 10 May 2011 by O'Reilly Media (who kindly provided me with a review copy). At 1100 pages, it certainly feels heavier than its advertised 2.6 pounds — but that may only be a side effect of the thought of wading through over a thousand pages of technical explanations and example code. Yet one could argue that the size is justified, considering the amount of information the book conveys, and its obvious aim to be a comprehensive treatment of the language. The material is organized into four parts, including 22 chapters. On the publisher's Web page, visitors will find a brief description, the complete table of contents, a few consumer reviews, reported errata (seven as of this writing, and none confirmed), the example code used in the book, some free content (the first chapter), and links to purchase the print and e-book versions.

The book commences with a multipart introduction, which begins with the sentence "JavaScript is the programming language of the Web." Even though that statement is not true — since there are many other Web programming languages — it does hint at the importance of the language in the mind of the author, and his willingness to put so much effort into creating such a detailed monograph. The introduction is also the first point in the book where one sees the clear demarcation made by the author between core JavaScript (i.e., the language definition, regardless of its runtime environment) and client-side JavaScript (i.e., usage of the language within Web browsers, including the use of libraries). Both areas are covered in great detail in the first two parts of the book, in quasi-tutorial format, while the last two parts cover the same areas, but in a purely reference format.

Specifically, the first part of the book, "Core JavaScript," offers almost a dozen chapters that explicate the basics of the language: its lexical structure; types, values, and variables; expressions and operators; statements; objects; arrays; functions; classes and modules; regular expressions; JavaScript subsets and extensions; and server-side JavaScript. At almost 300 pages, this part alone could form its own volume. The manner in which the author dives into the technical details, and the amount of example code, immediately make it evident that the book is intended for readers who have experience programming, although not necessarily in JavaScript. In fact, some readers — especially newbie programmers — may become frustrated with those places in the narrative where the explanation is not entirely clear. For instance, on page 7, the "points array from above" refers not to any code on that page, but instead refers to an array defined two pages earlier. Fortunately, such stumbling blocks are infrequent. For experienced JavaScript programmers, these chapters could provide a comprehensive review. For readers new to JavaScript, the material may seem overly dry, but the illustrative code should be quite helpful.

The ten chapters that compose the second part of the book, "Client-Side JavaScript," show how to work with the language within a Web browser. This includes learning how to embed JavaScript code in HTML files; differences among browsers and the versions thereof; the security of JavaScript code; the Window object; how to access and manage the elements within the Document Object Model (DOM); scripting CSS styles; events, and methods of handling them; scripting HTTP, and its use in Ajax (reflected in this edition's subtitle, "Activate Your Web Pages"); the jQuery library; techniques for storing data on the user's computer; how to use JavaScript to dynamically create and manipulate graphics, audio, and video content, as well as charts and drawings; and, lastly, the use of several HTML5 APIs. Speaking of that last topic, probably the most significant changes in this edition, versus the previous one, is the coverage of ECMAScript 5, as well as the new objects and methods introduced with HTML5. Naturally, some of these enhancements do not work in any version of Internet Explorer but the most recent, so the author discusses workarounds, if available.

As noted earlier, the third and fourth parts of the book constitute the purely reference material, with the first part focusing on core JavaScript, and the latter on the client-side aspects of the language. Every chapter is organized into a series of entries, each devoted to a particular class or object, ordered alphabetically. For each entry, the reader is given a brief synopsis, description, and in some cases example code and references to other entries. Each class entry also includes information on its properties and methods, where applicable. Each single method entry includes information on its arguments and any return value. The book concludes with what is arguably the longest and possibly most valuable index I have ever seen in a computer book.

There are only a few immediately-evident weaknesses of this book: Firstly, there are some phrases that may be clear to the author, but likely will prove baffling to the typical reader — e.g., "nonlinear cross-reference problem" (page 8) and "the jQuery gives a synopsis of each method" (page 523). Secondly, some of the example HTML code could have been written better, such as the use of an HTML table for defining the layout of a simple form, with labels and fields (page 13). Finally, despite the claims of the marketing copy that this title is suitable as both "an example-driven programmer's guide or a complete desk reference," it would serve better as the latter, and not as a tutorial for learning the language. Clearly, the more comfortable one feels with computer programming — especially JavaScript itself — the more that one could get out of this book.

On the other hand, there are far more pluses than minuses. One of the real strengths of the book is how the author does not hesitate to use (sometimes lengthy) blocks of code, with explanatory comments for almost every line, to clarify the language — as opposed to paragraphs of text, which could have easily doubled the length of the first two parts (which comprise roughly the first two thirds of the book). Also, in conjunction with the narrative and code fragments, the author makes effective use of figures whenever needed — particularly in Chapter 21, in demonstrating how to work with graphics and multimedia content.

Evolving with the language itself, and again brought up to date, JavaScript: The Definitive Guide still retains its crown as the ultimate reference resource for JavaScript programmers.

Michael J. Ross is a freelance website developer and writer."
Book Reviews

Submission + - Professional Mobile Web Development with WordPress

coder4hire writes: "Years ago, technologists and consumers alike could only dream of surfing the Web using the (increasingly ubiquitous) mobile devices available, such as smartphones. But that is now commonplace, resulting from a convergence of several trends: the standardization of wireless access protocols, greater carrier coverage and bandwidth, the popularity of mobile apps, and more powerful mobile products — featuring embedded keyboards and pointing devices, greater memory, hardware miniaturization, and larger screens with better resolution. For the typical website nowadays, the primary impediment to the site working well on leading mobile devices is that the site was never intended for them in the first place. Web developers and other site builders using content management systems, can now learn how to build for mobile accessibility, with help from resources such as Professional Mobile Web Development with WordPress, Joomla! and Drupal — authored by James Pearce, who is quite active in the mobile development space.

This book was published by Wrox, on 12 April 2011, under the ISBN 978-0470889510. It is a substantial volume, at 552 pages, which are organized into five parts. The bulk of the information is presented in the second and third parts. The former covers mobile development considerations independent of any particular content management system (CMS). It is in the third part that the author shows how to apply these techniques to websites and web apps created using the three leading CMSs — WordPress, Drupal, and Joomla. Most of the example code shown in the book, from a dozen chapters, can be downloaded from the book's web page. Unfortunately, the Zip file contains even more Zip files, which is rather annoying. The book's web page offers the table of contents (both the high-level and detailed ones), a brief author bio, the book's index, and a sample chapter (the first one). The book's introduction states that the web page has a link to errata, but there does not appear to be any such link. (Even if there are no errata reported, the link should have still been added, or at least an explanation as to its absence.)

The first part of this book, "The World of the Mobile Web," begins with an introduction to the mobile Web (which originated just a couple years after the birth of the Web itself), and discusses at a high level the similarities and differences between website development for the desktop versus mobile devices. The author then provides an overview of mobile technologies and networks, their technical limitations, recent developments therein, online information resources, and mobile browsers. Chapter 5, "The Mobile Toolbox," will probably be of more interest to web developers than the earlier chapters, because it surveys the mobile development techniques, server-side technologies, and development tools that are most often used for creating mobile-ready websites. For nondevelopers, the section that describes the key components of a CMS, can be valuable as an introduction to CMSs.

In the second part, "General Mobile Techniques," the author briefly discusses some of the critical options which a web developer must decide upon to structure a website so that it will be suitable for mobile viewers. These include navigation menu depth, breadth, grouping, and placement; typography, pagination, multimedia, and forms; and CSS and JavaScript. He also addresses a decision that likely will have even greater consequences for the long term maintenance costs of a new website, namely, the entry point(s) and structure(s) of the mobile and desktop versions of the site relative to one another. Chapter 7, which explores browser detection and methods of allowing the user to switch between mobile and desktop versions of a website, marks a shift in the book, where the reader is first exposed to any significant amount of code. Most of it is straightforward, but would be better without the use of the clunky heredoc method for outputting HTML from within a PHP script. Earlier, the author makes clear that device detection techniques (specifically, for screen dimensions) are not foolproof. Thus it is perplexing why his CSS code specifies pixel-based widths for images with a class "full" — presumably to fill the entire width of the mobile device's screen — because any pixel-based fixed width could turn out to be improper for the device upon which it is rendered. Wouldn't something like "100%" be a much safer choice?

In Chapters 8 through 10, the author presents user interface patterns seen in the major content management systems — forms, content lists, image galleries, and comments — and discusses how they can be applied to websites intended to support mobile devices. The only information that seems to be missing is the reason, if any, the author recommends using divs for grouping input fields, and not (more semantically correct) fieldsets. He also discusses some key design considerations, as they relate to mobile websites (including CSS media queries), and some HTML/CSS templates and libraries that can be used as starting points (especially valuable if you want to roll your own solution, and not use any CMS plug-in).

The third part of the book, "Major CMS Platforms," demonstrates how to develop mobile websites using the three most commonly-used CMSs — WordPress, Drupal, and Joomla — and how to add more capabilities beyond what is provided by the chosen plug-ins. For WordPress, the solutions examined are dotMobi WordPress Mobile Pack (for which the author appears to be the lead developer), WPtouch, Mobile Edition, MobilePress, and Automattic WordPress. For Drupal, the main weakness in the material is that the author posits the Mobile Plugin module as a solution for Drupal 6 and 7 (even discussing Drupal 7 permissions), but there is no version of it for Drupal 7 — not even an alpha release, and there is no indication there ever will be one. Also, in Chapter 14, the API calls do not work for Drupal 7. Yet the coverage of the topics is generally clear and engaging.

In light of the growing popularity and capabilities of JavaScript frameworks, it is no surprise that in the fourth part of the book, "Enhancing and Launching Your Site," the author explores alternatives to the methods he presented in earlier chapters, by using two such frameworks for mobilizing websites: jQuery Mobile and Sencha Touch. The example code is based upon a WordPress website, and leverages a switcher plug-in and other code discussed earlier in the book. The penultimate chapter covers various techniques for testing and debugging mobile websites: browser plugins, mobile emulators, and online testing services. The last chapter discusses issues with (the network carriers') transcoders, traffic analysis, and mobile search and monetization. The fifth and final part of the book, "References," contains a handy glossary, as well as two appendices that provide recommendations for further reading and developer resources specific to the three CMSs utilized in the book, and various mobile Web organizations and industry players.

Overall, the writing quality is a bit better than average for computer books, with detailed and helpful explanations. However, in several cases, the author uses words he doesn't seem to understand: "RIM's legacy browser remains very populous" (page 68; should read "popular"); "inadmissible flaw" (page 185; one can only guess at the intended use of this judicial word); the delightfully redundant "pre-prepared" (page 208); and "rallied against" (page 209; should read "railed against"). There are numerous simpler errata: "as [a] whole" (page xxvi), "appraised" (page xxvii; should read "apprised"), "been build" (page 3), "switchboard[s]" (4), "connected [to] the Internet" (11), "marking" (11; should read "marketing"), "it's [a] phone" (14), "these are dealt with these" (19), "phone's" (40; should read "phones'"), "try and catch" (45; should read "try to catch"); ". at" (46), "is [a] good start" (75), "most CMS[s]" (116), "some CMS[s]" (125), "a[n] XML" (140), "an pertinent" (166), "you are introduced you" (182), "to [an] extreme" (185), "on [a] par" (187), "part [of] the" (188), "wheedle out" (199; should read "weed out"), "scaling is down" (200; should read "it"), "comprised of" (220), "there comments" (227), "go [to] the" (230), "allow you [to] tweak" (247), "Index.php" (262), "in [a] box" (269), "[non]greedy" (280), "http:// yoursite" (305), "suit[e]s" (340), and at this point I stopped recording errata.

There seems to be no consistency in the formatting of URLs: the inclusion or exclusion of "http://" and root directory slashes was seemingly decided upon randomly (e.g., page 53). One may find the occasional comma where a period was called for (same page, third paragraph). Also, there is an excessive use of exclamation marks, particularly in the earlier chapters. Lastly, the author has an odd habit of phrasing statements of what material will be covered next, in a commanding form, e.g., "you turn your attention to examining" (page 97) instead of, say, "we turn our attention to examining." It's not important, but it's unsettling, and in a couple cases, rather baffling, e.g., "You should briefly discuss how to access HTTP headers in your code" (page 133). With whom should the reader discuss it? Yet the book's style is, for the most part, conversational and easy to digest.

Readers will find plenty of illustrative figures. Although all of them are black and white only, they are without exception top quality and quite attractive, including the many screenshots and product images. The only place a figure is sorely needed, is on page 261, to clarify the discussion about em-based padding. The chapters end with brief summaries, which are of no value and simply make the book a bit longer than it needs to be. Also adding unnecessarily to its heft is the repeated reminder that the example code can be downloaded from the Wrox website.

Aside from the aforementioned blemishes, this book does a fine job of introducing the reader to all aspects of developing CMS-based websites suitable for mobile devices.

Michael J. Ross is a freelance website developer and writer."
Book Reviews

Submission + - Drupal Web Services

coder4hire writes: "In the evolution of the Web, one of the most significant improvements was the general transition from static websites based only upon HTML, to dynamic websites based upon scripting languages. But even then, each website was much like a silo, with no publication of content beyond the pages provided on the site itself. That all began to change with content syndication through RSS, and the development of web application APIs. Nowadays, a growing number of organizations are publishing online content through web services, as well as consuming content published by others. These sites can be built using Drupal, an open-source content management system (CMS). Drupal Web Services, a book authored by Trevor James, aims to help web programmers do that sort of development.

Released by Packt Publishing on 24 December 2010, under the ISBN 978-1849510981, this book is the only one currently on the market that focuses on how to "integrate social and multimedia web services and applications with your Drupal Web site" (to quote from the book's marketing copy). Its 320 pages are organized into a dozen chapters and one appendix. The publisher makes available a web page with a description of the book, its table of contents, and a sample chapter (Chapter 9, "Twitter and Drupal"). The page notes that readers do not have to have any programming expertise, but should be familiar with the use and administration of a Drupal site. The book covers Drupal 6, as version 7 had not been finalized and released until a couple weeks after the book's publication. Visitors can also read the reported errata (of which there are none, as of this writing), and download the example code used in nine of the chapters. (This review is based on a print copy the publisher kindly provided. An e-book version is also available.)

The first chapter serves as an introduction to web services at a high level, including remote procedure calls (RPC), as well as some of the most commonly used protocols, with some focus on Representational State Transfer (REST). The author then gives several examples of web services that can be consumed by a Drupal website, and others where the site provides the service. This material is a fine overview, although nonprogrammers may be scared away unnecessarily by the inclusion of coding details, such as the Mollom service requests. Also, the writing style is rather repetitious in some places, e.g., "it will cost you to sign up for it. It's not a free service" (page 16). More amusingly, on page 9, the author states, "The computer that contains the application [] can be anywhere in the world," and then adds, "It could be sitting on a server in the US, Europe, Asia, South America, or somewhere else" — as if any reader might be unfamiliar with the major regions of the world. On the other hand, some readers may appreciate a slower narrative pace. Yet most troubling of all is the claim (on page 12) that many of the popular web applications are based on PHP (as is Drupal), and thus we have the advantage of "a common programming language." That contradicts the whole point of web services, namely, sharing data and other resources among websites regardless of those sites' underlying technologies. A typical web service does not transmit source code, hence its language is irrelevant, as is the language of any other website with which it interacts. (This so-called advantage is never substantiated, or even explained, anywhere in the book.)

The next four chapters take a detailed look at how a Drupal website can consume third-party web services, beginning with the use of Simple Object Access Protocol (SOAP) in general, and two contributed modules in particular (the SOAP Client module, and the FedEx Shipping Quotes module — which depends upon the Ubercart shopping cart module). The discussion of the topics is complete and straightforward, with screenshots as needed to show what administrative forms need to be filled out by anyone following the instructions. This approach is followed in the subsequent three chapters, which show how to use the web services of Flickr, Amazon, CDN2, and Kaltura. Chapter 5 discusses video, and thus its coverage of the Media:Flickr module for turning photos into slideshows should have been placed in the third chapter, which was devoted to Flickr.

Chapter 6, which focuses on the use of the Services module, essentially begins the second part of the book, because the reader starts learning how to make a site provide web services, i.e., no longer acting solely as a client — although there are some cases where web services are consumed at the same time as they are offered to outside clients. The Services module works in conjunction with other Drupal modules that implement web service methods (SOAP, REST, JSON, etc.). All of the examples are helpful, but the photo_service_all() function on page 136 is odd, because the author states that it returns an array of nodes, but the code suggests instead that it returns the nodes' content, concatenated together as a string. Similar to the first part of the book, the remaining chapters in the second part focus on specific web services: CAPTCHA, reCAPTCHA, TypePad, Mollom, Google Docs, Twitter, LinkedIn, and Facebook. Chapter 12 explores the authentication services OpenID and OAuth, but strangely ends by stating that it is time to test the OAuth connection, with no explanation as to how to do so. Incidentally, to Drupal administrators unfamiliar with the use of the Views module, the first sentence on page 205 will likely be quite confusing, because it conflates fields with filters. (The phrase "filters in" should be replaced by "includes" or "uses.") Also perplexing is that on pages 209-210, the author advises the use of "http://" instead of "www." in short URLs, but two pages later the results show the opposite. The phrase "FBML is now considered by Facebook" is baffling; considered what by Facebook? Lastly, the author states that OAuth will be tested with Digg (page 259), but that is not covered.

The book's sole appendix briefly presents each of the major contributed modules used, organized by chapter. For each module, there is a brief summary of its purpose, the current maintainers and version, and links to its project page and usage statistics. Two passages in Chapters 7 and 8 suggest that the book's appendix was not finished as intended: The author states (page 150), "I've attached the code for the recaptchalib.php file as an appendix in this book," but that does not appear to be the case — which is fortunate, because the book should not be made longer by including source code that is easily available to the reader. On page 177, we are told that the appendix explains how to install Acquia Drupal, but it does not.

The figures used in the book are, for the most part, quite handy, to see the results — especially for the reader following along who does not want to implement all of the instructions. However, the first screenshot on page 103 and the second screenshot on page 114, were incorrectly swapped for one another, and thus do not match the respective descriptions in the text.

Even though the writing quality of this title is a bit better than the typical programming book nowadays, there are some problems. Countless verbs are prefixed by the (useless) phrase "go ahead and" — to the extent that the reader will be sick of it by the time he reaches the end of the book. Occasionally the phrasing is rather puzzling. For instance, on page 131, the screenshot shows that a list of field names should be separated by commas, with no spaces. The author's explanation is "Make sure to not avoid spaces"

There are a couple instances in the book where critical configuration settings are not introduced or explained until after the reader is told that he will see results from following all of the earlier steps (which include most of the configuration settings). For example, in Chapter 4, the author instructs the reader to install the Amazon, CCK, and Features modules, and test everything using the Amazon Examples module. Pages later — possibly after the reader has been frustrated in trying to get the example scenario to work — he is told how to configure the Features module to enable the Amazon Examples features.

As with most Packt titles, the copyediting is quite poor, with inconsistent punctuation and plenty of errata that should have been caught in the production process: "and and" (on the "About the author" page), "at [the] time" (page 3), "try and access" (page 11; should read "try to access"), "a RPC" (page 15), "[a] server API" (18), "APress" (22), "is a not a" (25), "delivery Information" (43), "on how" (70), "to to" (89), "you [c]an" (94), "extention" (97), "the the" (106), "user Drupal user" (184), "se e" (198), "CMS(" (232), "both the methods" (252), "Try it both methods" (258), and "sign [in] to" (259). There are countless places where the term "the" is missing, e.g., twice on page 16. The menu path delimiter used is sometimes ">" (e.g., page 226), but usually "|," which makes each menu path look too much like page links in a footer.

However, the main problem with the narrative is that the author repeats information — in most cases not just once, but numerous times. For example, in the second chapter, we are told three times that the author will present the SOAP and FedEx shipping quotes modules. By the time the reader reaches page 33, he likely will already be tired of being told the same information. But on that page alone, the author goes over the same ground two more times. In fact, the beginning of the second paragraph sounds like a copy of the first. Compounding the problem, the author will frequently take some of the material from the main section where it is discussed, and add it to the tail end of the previous section — somewhat like a preview, but wholly unnecessary. Packt Publishing's content editors should have caught and weeded out this redundancy. Each chapter ends with a summary, which add no value and exacerbate the repetitiveness of the chapters' main content. One glaring example of redundancy, in the last chapter, is the second go-round of how to define a Twitter application, which had already been covered in Chapter 9.

Yet one advantage to repeating explanations, is that no reader will miss key instructions. This would be most advantageous to readers skimming the material at a fast pace, or anyone new to administering a Drupal website and consequently lacking in confidence. Anyone reading this book will likely be impressed by the way that the author patiently steps the reader through every process. Due to the detailed explanations, each chapter stands on its own, thereby making it possible for the reader to learn a particular topic without having to read any of the earlier chapters. This also makes the book valuable not just as the tutorial, but for reference purposes.

With clear and thorough explanations, Drupal Web Services would be an solid resource for anyone who wants to connect a Drupal-based site to any web service, including the major social media applications.

Michael J. Ross is a freelance website developer and writer."
Book Reviews

Submission + - Pro Drupal 7 Development, Third Edition

coder4hire writes: With the growing interest in Drupal as a platform for developing websites, the number of books devoted to this CMS has increased from a handful to now several dozen. Consequently, intermediate and advanced Drupal programmers may wonder which one of those books would be their best choice as a single resource for learning how to create custom Drupal modules and themes. Ever since its first edition in April 2007, the Pro Drupal Development series from Apress is more frequently cited as the best candidate than any other.

In its third edition, Pro Drupal 7 Development is now helmed by Todd Tomlinson and John K. VanDyke, and again features a forward by Dries Buytaert, the founder and project lead of Drupal. This edition was published on 29 December 2010 under the ISBN 978-1430228387. The publisher offers a fairly sparse Web page for the book, containing a brief description, the source code used in the book, a page for errata (several reported), links to purchase both the print and electronic versions (oddly, with no bundle discount), and a section for author information, which currently has no entries. At 720 pages, it is the longest Drupal book on the market, as of this writing (and should remain so until the scheduled release of Wiley's Drupal 7 Bible). Yet Pro Drupal 7 Development is not terribly thick, probably because its paper appears to be thinner than that typically used for programming books. Although this allows the text on the other side of each page to show through slightly (and no doubt unintentionally), it generally does not pose a problem, but would have if a paper any thinner had been chosen.

The book's material is organized into 25 chapters and two appendices, covering numerous topics: Drupal infrastructure, including requisite Web technologies; module development basics; hooks, actions, and triggers; the menu, database, user, node, field, and theme systems; blocks; the form API; the filter system; searching and indexing content; file management; taxonomy and vocabularies; caching; sessions; jQuery; localization, internationalization, and content translation; XML-RPC; how to develop secure code and other best practices; site optimization; installation profiles; testing; Drupal database reference; and other resources. Given the sizable number of chapters and topics explored in this book, it would be impractical to attempt to provide any sort of full synopsis in this review. Instead we will focus more attention on those topics that will be of greater importance to Drupal developers (a phrase used to distinguish them from any Drupal site builders who do not create their own modules or modify existing ones).

The subject matter presented first — how to structure module code and make use of Drupal's hook system, as well as actions and triggers — is essential reading for anyone new to these topics (but presumably could be skipped by any veteran programmer familiar with them from earlier versions of Drupal). Most readers should find that there is sufficient information provided to understand the concepts and/or the code being presented, but there are a few exceptions: For instance, on page 22, the narrative refers to only a single node, but the code in annotate_node_load() suggests multiple nodes are being processed. Also, readers following along by implementing the example code, will likely be frustrated that the action "Beep multiple times" is not displayed in their own "Trigger: After saving new content" list box (page 42). Fortunately, these are the exceptions, because the authors present the ideas at a measured pace, with sufficient groundwork so readers will not become lost.

An understanding of Drupal's powerful hook system, is a necessary foundation for learning the concepts that form the heart of this book — namely, the menu, database, user, node, field, theme, block, and form systems (often referred to as the Drupal APIs). The presentation of the ideas is done in a methodical fashion, with plenty of example code and screenshots. Readers who patiently work their way through the material — particularly if they try to get the code working in their own Drupal environments, and perhaps even experiment with variations — will likely find it a time-consuming process, yet they will be richly rewarded for their efforts. The only blemishes are the several places in the text where there is a mismatch between the narrative and the code, or between the code and a screenshot. Several examples should suffice: The menufun_hello() function on page 67 is missing code for the two @from variables. Page 76 refers to a mysterious "second parameter, $b." The $items code on page 77 is close to what is in Drupal 6's user.module, but is nothing like Drupal 7's. Remarkably, "%index" appears in a section head (page 79) but nowhere in the text. The pager display code (on page 96) is missing "$result = $query->execute();." A "module named dbtest" (page 111) doesn't seem to exist.

The topics covered next in the book generally go beyond the Drupal APIs, and are much more diverse. Readers will learn how to filter user input, as well as how to allow users to search a site's content, upload files, and characterize nodes using terms from taxonomy vocabularies. Incidentally, the chapter on caching would have been better positioned just before the chapter on optimizing Drupal's performance, since the two areas are so closely related. Yet both are invaluable for minimizing the page load times for any substantial Drupal-based site. The authors show how, within Drupal modules, to utilize jQuery and XML-RPC. The chapter devoted to localization and translation — a subject growing in importance as sites go multilingual — is quite thorough.

The last five chapters of the book address topics that can help anyone become a better Drupal developer: code and form input security, programming best practices, Drupal site optimization, installation profiles, and testing techniques. Even though the authors provide a full chapter on Drupal programming best practices, there are similar nuggets of wisdom sprinkled throughout the other chapters — evidence of the authors' deep experience writing Drupal code, and seeing the pitfalls. The book's two appendices consist of a Drupal database reference, which describes all of the tables and their columns, and a summary of Drupal resources aside from the book, including user groups. The book concludes with an index that is missing some key concepts (e.g., permissions and roles), and would have been able to include more entries if the publisher had not chosen to use an unnecessarily large font and line height.

Each chapter concludes with a brief summary, and all of these summaries provide no value and should be dropped from any future editions. For each one of the items labeled "Note" (scattered throughout the book), if it repeats information mentioned in the text (some just a couple sentences earlier), then it should be excised; otherwise, the information should be folded into the text. The book's narrative could be improved in other ways: There are a number of instances where the authors refer to particular lines of code in the example code, and it would have been most convenient for the reader had line numbers been used. Module names are often incorrectly presented in all lowercase (e.g., page 13). Occasionally some phrases or acronyms should have been explained (or not used), such as "HA companies" (page xxix). On the plus side, the material is occasionally livened up with some welcome humor, such as the devilish functionality of "Evil Bob's Forum BonusPak" (page 14) and some equally devilish deadly pets (page 282). At first, readers may chuckle at the phrase "Drupal's legendary snappiness" (page 499), but evidently the authors were not being facetious.

The example code sprinkled throughout the chapters is especially helpful to the reader, and there are only a few places where the code does not match the narrative, or the code is incorrect in some other way (aside from those instances mentioned above): The text on page 14 neglected "annotate.admin.inc"; and in the listing for annotate.info, the "configure" path should not include "content/." In the discussion on paged display (on page 96), "clicking on 5 would take the visitor to rows" 41 through 50, and not "51 through 60." The code on pages 147 and 149 erroneously refers to "punchline" and a joke node type in job_node_access(). On page 355, field_tags is identified as field_geographic_location. The contents of the files in the downloadable source code do not always match what is seen in the book, starting with annotate.info (page 14) and annotate_admin_settings_submit() (page 20). Even worse, the source code for Chapters 3-6, 12, 13, 15-17, 19-22, 24, and 25 is missing completely.

There are numerous other, more simple errata: "-sites" (page 8), "an[d] installing" (9), "/q=node/3" (10; missing the '?'), "modules /" (17), "[the module] removes" (19), "hooks key" (45; should read "triggers key"), "beep_multiple_.beep_.action()" (49), "end" (55; should read "beginning"), "to [the] module" (61), curly quotes in code (63, 67, 190, etc.), "%user_uid_only_optional" (77), "function_menufun_menu()" (79), "product" (98; should read "produce"), "lower-case" (111), "users signature" (117), "[the] time" (118), "themeing" (153), "seconary" (190), "to and an" (308), "php", "class. the", and "apis" (all on page 323), and "pave" (409). At that point, I stopped recording the errata. Most if not all of these errors should have been spotted in the book's technical review process, assuming they were not introduced after the reviews were done.

For computer programming books, information presented outside of the narrative — such as figures and example source code — can either greatly enhance the reader's experience, or undermine it. In Pro Drupal 7 Development, the diagrams and screenshots are relatively few in number, yet are used effectively, with only a few errors: The caption for Figure 3-8 appears to be incorrect, as is the URL in Figure 4-5. Figure 5-1 contains an erroneous "$database". Table 17-1 is missing a row for uid 0. The screenshots in Figures 19-1 and 19-2 are quite fuzzy and difficult to read.

A few comments on the book's physical design and production are called for: In the review copy that the publisher kindly sent me, the first text block signature consists of only the first two leaves. As a consequence, that signature had almost no glue holding it into the binding, and had already started to separate from the binding. The production team should have anticipated this sort of problem; but it may have been a choice driven by pending changes to the title and/or copyright pages.

Fortunately, none of the above flaws are significant compared to the wealth of information provided by this book. Pro Drupal 7 Development clearly demonstrates why, in the minds of countless Drupal developers, this series is the gold standard for learning the inner workings of Drupal, and how to utilize them for building custom modules.

Michael J. Ross is a freelance website developer and writer.
Books

Submission + - Foundation Drupal 7

Michael J. Ross writes: "Of all the better-known content management systems, Drupal is oftentimes criticized for having the steepest learning curve. Yet that would only be a valid charge as a result of Drupal's great power and flexibility — particularly in the hands of a knowledgeable Drupal developer. But how can the interested programmer begin gaining those skills, as quickly as possible? One approach is to read and work through the examples of an introductory book, such as Foundation Drupal 7, written by Robert J. Townsend (except for a chapter contributed by Stephanie Pakrul).

The book was published on 15 December 2010, under the ISBN 978-1430228080, by "friends of ED", which is both a division of Apress and arguably a baffling name for a publisher's imprint. The book's material spans 328 pages, grouped into 12 chapters and four appendices. The publisher's page offers a description of the book, and a link for purchasing the e-book version. Visitors can also read a few dozen of the least interesting pages in the book, using a lame modal interface "powered" by Google Preview's book viewer system. As of this writing, the author's own site for the book appears to have no useful content. In fact, even a few weeks after the publication of the book, the site had no word as to how to use the site or even obtain an account, and there is nothing pertaining to that in the book. Now, it appears to be the beginnings of a demo site.

The book's chapters can be loosely grouped into four parts: The first three chapters provide an overview of Drupal, and explain how to set up a local Web server, install Drupal 7 on it, and configure the new site. The material composes an adequate introduction, but there are some false statements readers should watch out for, such as: newly created blocks are added to nodes (page 15); "Drupal will not run on most inexpensive hosting plans" (pages 19 and 20); "server settings and update notifications must be configured" (page 35; actually, they are optional); "the default Garland theme" (pages 40 and 55; no longer true in Drupal 7); a block can be any shape (page 48; as long as it's a rectangle!). But the discussion on multisite setups — while likely intimidating for Drupal newbies — is well worth reading by anyone who has not yet tried running multiple sites from a single Drupal instance. However, the ."demo.d7" suffix (page 28) should have been explained. In the introduction, the author noted that the book is primarily intended for readers who have little or no experience with content management systems in general, and Drupal in particular. The early chapters hew to that approach, going so far as to briefly present the basics of databases — material that experienced programmers can safely skip.

Node fields, content types, taxonomies, users, roles, permissions, and modules (both core and contributed) are key components in building a site with Drupal — and they are explicated in Chapters 4 through 7. The narrative is quite descriptive, and readers new to Drupal may find some of it tough going; but it will be worth their while to read through all of the material, at least once, while exercising their newfound knowledge on a test installation of Drupal 7. Most of the discussion is clear and straightforward, but a few spots will likely perplex readers, e.g., "all search fields are hidden by default when either search view node is enabled" (page 85; what search view nodes?). Also, on pages 69 and 87, the author advises readers to limit a system name to seven characters, but each example given exceeds that number. Such inconsistencies can prompt readers to begin questioning the author's advice and attention to detail. As a resource perhaps unique to this Drupal book, the sixth chapter explores the purpose and basic usage of most of the core modules not enabled by the standard installation. Drupal newcomers invariably wonder what contrib modules they should first be trying out and learning, and the author presents several of them in the seventh chapter, which includes a helpful comparison of using the Webform module versus nodes for collecting data from users.

Nonprogrammer website creators — who must rely entirely upon the GUI of a content management system to build a site — are strongly influenced by the visual appeal of a CMS's built-in themes, and not necessarily its flexibility or other differentiating factors. (One can only speculate as to how many such people have chosen Joomla over Drupal based upon the former's more attractive default themes.) Thus, theming can be especially significant to non-technical Drupal site creators, and is covered in the next two chapters, the first of which was authored by Stephanie Pakrul. To illustrate the ideas discussed, she uses her own Vibe theme, which is a sub-theme of Fusion. Unfortunately, as of this writing, there are no releases of Vibe, so it is not clear how readers are expected to download it as instructed (on page 174). Consequently, readers won't be able to see on their own Drupal installations what she shows in the screenshots. This is just one more example of how this book appears to be unfinished. Some readers may become frustrated with the way that she often gives instructions but fails to identify the page on which to perform them. Also, the Skinr block settings shown in the book look nothing like what I am seeing using the latest versions of Fusion and Skinr, but that may be due to Vibe missing. Skinr's project page currently warns that it is not stable or functional for Drupal 7; this makes it a poor choice for a book aimed at beginners, who can be easily derailed by such problems. Several details are incorrect, e.g., the Firebug technique shown in Figure 8-14 does not use double-clicking, as stated, but simply mouse hover. Chapter 9 provides advice on using Photoshop and Illustrator CS5 for working with layouts, text, colors, and images in designing Drupal themes.

The last three chapters discuss topics related to deploying a site. Chapter 10, "Going Live," presents the details of the author's strategy for using separate sites for development, staging, and production. This involves executing Linux commands on the command-line, and at one point even deleting the public_html directory and creating a symbolic link. It is easy to imagine readers being hesitant about doing so — especially in a client's account — and for such people, using only an FTP application might be more palatable, even if it takes extra time. The next chapter offers some valuable best practices for maintaining a production site, including techniques to be automatically notified when installed modules become out of date. The last chapter, "Translating Business Requirements to Drupal Functionality," may at first glance seem inappropriately placed at the end of the book, because shouldn't the developer analyze the client's business requirements before beginning any work on their future website? But this chapter does belong at the end, because most of its topics will make a lot more sense to the reader after she has learned the basics of a Drupal site. The only confusing aspect of this material is the author's recommendation to add 25 percent to both the amount of estimated time to complete a project and also one's hourly rate, with no explanation for the rate increase. Nonetheless, the chapter presents some worthy advice on how to be a more effective Drupal site builder.

The book's four appendices briefly cover search engine optimization for Drupal sites; Drush (a command-line shell for Drupal); a survey of more than 50 useful contrib modules; and usage of the Views module to address some common query-building needs. Note that the Views carousel module — which is one of two image slideshow modules listed — was deprecated awhile ago.

All of the chapters except the first are capped off with summaries, which add no value to the book and consist mostly of unneeded reminders that begin with "I talked about," "I then talked about," etc. One of the summaries (page 214) states that a particular website was used as an example, but it wasn't even mentioned in the chapter itself. A strength of the book is that there are plenty of screenshots throughout, and most of them are helpful. But their captions typically repeat information stated immediately before the figure, and thus add unnecessary text.

Readers may become disappointed with an overall sense that the book was not crafted and edited properly, perhaps in a desire to rush it to market in order to cash in on the growing interest in Drupal and the release of Drupal 7. Any such urgency could account for the poor decisions in the production of the book. Some of the material appears unfinished, or at least unpolished. For instance, Chapter 1 ends quite abruptly, with no chapter summary, unlike all the others. The first part of a sentence on page 184 is completely missing.

It is not always clear as to which problems are caused by the authors, and which by the publisher. As a minor example, many of the module names are incorrectly presented in all lowercase (especially in Chapters 6, 7, and 11), in some cases rather pointedly (e.g., "cck") and in others a bit confusingly when in mid-sentence (e.g., "views"). Was that the author being sloppy, or an overzealous copyeditor who did not realize that title case is appropriate for the proper names of the modules?

Some of the problems could only originate from the author. There are countless instances of weird and perplexing instructions, such as "log on and log in" (page 266). On one page alone (127), readers will encounter "Make sure the configure it after saving if applicable" and "Configuration, Languages should be screen text style." There are numerous errata: "postgresql" (page xvii), "blog" (page 15; should read "block"), "minimum the PHP requirements" (21), "Drupal 7-1 to 7-2" (35), "ä" (60), "of [a] single" (68), "of [the] fields" (74), "per-configured" (76), "a decimal [point]" (77), "be round[ed]" (77), "by [a] user" (83), "how which fields" (85), "requires updated or not" (131), "delimeter" (163), "ie" (175), "This [is] where" (196), "comments are will" (198), "aka" (226, 270, and 278), "is usually means" (240), "site to bake" (243), and "described in earlier in the chapter" (248).

The pace of explanation varies tremendously, from one section to the next. For instance, several paragraphs might discuss fundamental Drupal concepts slowly, with full explanations, and then only a page later the reader is entangled in fairly advanced topics, with little or no preparation. Many readers will find appealing the informal conversational style — although in a few instances the wording is unintentionally humorous, such as the phrase "most exciting" transformed into "most excitedly" (page xxi).

Other problems can only be laid at the feet of the publisher, such as incorrectly bolded words, even for individual characters in words (e.g., pages 87, 110, 233). The publisher chose to use the smallest font of any technical book I've ever seen, and consequently people with vision limitations may have difficulty reading the text. Also, many of the screenshots are rather pale; in most cases this is not a problem, but some of the images look fuzzy. In contrast (no pun), the image in Figure 9-4 is an unreadable black rectangle containing a stack of smaller gray rectangles, and the background is effectively indiscernible. Readers will wonder how the production team let that obvious problem slip through the cracks. The image used for Figure 4-15 evidently had its right side chopped off. Several of the pages contain small gray and brown lines, dots, and splotches; but those blemishes may be limited to my copy of the book.

Writing and releasing a book prior to the final release of the software, is always fraught with danger. Some of the Drupal-generated warning and error messages mentioned in the book differ from what would be seen using the final 7.0 version, which was not available to the author during the writing of the book. This is likely also the reason why the list of core modules (Table 1-1) is missing the Options module and includes the now-absent Profile module. But that would not explain why the critical System module is missing from the list. Also, the "Secondary menu" mentioned on page 56, is now gone, although secondary links are still part of Drupal 7. In terms of theming, the default site theme is Seven, and not the venerable Garland; also, the Minnelli theme (page 63) — Garland's fixed-width counterpart — was excluded from the final 7.0 release.

In essence, this book was not well executed, and yet it has a lot of promise. A second edition — perhaps for Drupal 8 — could rectify most if not all of these problems. The author's passion for Drupal is evident and inspiring: He shares hard-won and sincere advice for avoiding disaster in working with clients and working on their websites. Also, he notes in the introduction that 10 percent of all profits from the book will be donated to the Drupal Association. Although it is in much need of polishing — and in some places a full overhaul — Foundation Drupal 7 provides information and guidance that would be helpful to anyone who wants to learn how to use Drupal for creating websites.

Michael J. Ross is a freelance Web developer and writer."
Book Reviews

Submission + - Drupal 7 Module Development

Michael J. Ross writes: "While it is possible to create a simple website using a base installation of Drupal, the real power of this content management system is achieved through the use of modules, which can be thought of as add-ons that extend the capabilities of Drupal in specific ways — oftentimes in conjunction with other modules. These modules are developed and contributed by PHP programmers who understand how to use one or more of the Drupal application programming interfaces (APIs) to access information stored in a Drupal database, such as content, user profiles, and theme settings. These APIs have changed with Drupal version 7, and thus Drupal coders could benefit from a book that explains how to create Drupal 7 contrib modules.

One such resource, titled Drupal 7 Module Development, was made available by Packt Publishing on 3 December 2010, under the ISBN 978-1849511162. It has half a dozen authors, all of whom are highly experienced Drupal programmers and contributors to this burgeoning open source project: Matt Butcher, Greg Dunlap, Matt Farina, Larry Garfield, Ken Rickard, and John Albin Wilkins. This team effort spans 420 pages, organized into a dozen chapters, and two appendices. Angie Byron, the Release Manager for Drupal 7, starts it off with an interesting and upbeat foreword that concisely summarizes the primary goals of this latest release of Drupal. Following it is a preface whose chapter summaries are poorly written — almost as though the writer knew nothing about Drupal. Speaking of technical knowledge, readers are expected to be familiar with Drupal, PHP, HTML, and CSS — the more so, the better. For the jQuery material, an understanding of that library and JavaScript itself would be valuable. Packt Publishing hosts a book Web page that offers a detailed description of the book, links for purchasing the print and electronic copies of the book (or the two combined, for a large discount), and the example source code for nine of the chapters (also available from the book's GitHub repositories). As with all of its other titles, the chapters end with summaries, which provide no value and simply waste space.

This book's first chapter, "Developing for Drupal 7," provides an overview of the purpose of custom modules, the practical approach that the authors will take in explaining how to create such modules, the Web technologies underpinning Drupal, the Drupal architecture, its major subsystems, and various tools commonly used for Drupal programming. Oddly, the authors hope "that the code mentioned in this chapter can serve as a foundation for your bigger and better applications," and yet no code per se is mentioned. Nonetheless, the chapter does serve as a decent introduction for PHP programmers new to "the Drupal way." The second chapter, "Creating Your First Module," shows the reader how to do exactly that, using a very simple module to illustrate the basics, such as the files that typically compose a Drupal module, as well as some Drupal coding standards. Unfortunately, regarding the code on page 38 that checks whether the $path variable is "admin/help#first," no explanation is provided as to why the "#" is not a "/," given that the URL path in the reader's browser will be "/admin/help/first," and the "#first" does not refer to a page anchor. After a worthwhile detour into Drupal internationalization and the t() function, the authors introduce both the Block API and the Testing module, through example. Incidentally, readers trying out the sample code will want to add "static" to "public function getInfo()" in first.test — as is done in all of the other Drupal 7 core test files — to avoid a PHP "strict" warning of a static call to getInfo() in simpletest_result_form().

The next two chapters focus on theming — specifically, Drupal's theme layer and techniques for theming a custom module. The material in both chapters is arguably comprehensive, and thus ideal for a reader already well-versed in Drupal 6 module development. But, for anyone else, it will likely be overwhelming in its dense detail and in the fast pace at which it is presented — and thus will discourage most newcomers. The former chapter presents numerous high-level concepts, while the latter is intended to illustrate those ideas by focusing on module theming. Yet even if the reader carefully examines and implements the sample code — usually the best way to learn any sort of programming — these chapters will probably prove quite difficult for readers to comprehend thoroughly, unless they have prior experience along these lines. Oddly, the Chapter 4 summary tells the reader that she should have "learned a little bit about contributing your experiences [sic] and knowledge back to the Drupal community," but the material does not explain how to do so. (More on that topic later.)

Chapter 5, "Building an Admin Interface," provides a detailed survey of the Drupal menu system, the Form API (including how form data is saved, which is inadequately covered by some other books), Drupal's built-in e-mail system, and the use of tokens therein. The coverage is again detailed, and would be even better had the remaining commonly-used HTML form elements — such as list boxes and radio buttons — been shown in the example code. For those readers whose heads are still spinning from the previous two chapters, this material may be a welcome change, in that the explanations are slower paced, with seemingly greater attention given to whether the Drupal newbie will be able to learn what is being taught, step by step. However, any reader who is using this chapter as a reference when creating a custom implementation of hook_menu(), will doubtlessly become frustrated by the inadequate advice on determining the valid possibilities to be used in the access arguments array: "[check] the hook_perm() implementation of the module in question." But what module? The reader is presumably creating a new one from scratch, with no permissions already set; so the authors must be referring to an existing module — but which one? If the reader were to search through all of the core and example modules, he would find no hook_perm() functions. Do the authors mean hook_permission()? This illustrates how critical it is for authors and technical editors of books purportedly for beginners, to strive to put themselves in the shoes of the poor reader, who does not possess their knowledge and experience.

As with any CMS, "content is king" for sites built using Drupal. Thus it is critical for Drupal module developers to know how to dynamically create and manage all of the elements required by a module working with content: node, entities, fields, etc. In earlier versions of Drupal, the familiar "node" concept did not encompass all of the non-node data types, such as users and comments — forcing developers to create workarounds in their modules and in their sites as a whole. Version 7 introduces "entities" and "bundles" (which can be thought of as sub-entities), to allow greater flexibility for programmers. Chapters 6 and 7 delve into these concepts, with plenty of example code and explanations thereof. Readers learn how to create database tables indirectly using the Schema API, define new entities, give users the capability to manage them, encapsulate multiple database operations into transactions, and define new field types, widgets, and formatters.

Chapter 8, which focuses on how to set and use permissions within modules, is straightforward, and includes sections on the secure use of regular form processing, as well as AJAX callbacks (for interactive form behavior that avoids the necessity of reloading the current page). Incidentally, there appears to be an error in the code on page 221: "function example_menu() example_menu() {." Chapter 9 continues in the same realm of security, specifically, use of the Node Access system within Drupal. The coverage is quite thorough, and the only problem is that some of the "tips" blocks repeat information found in the regular text. The chapter concludes with some valuable advice on how to test and debug node access modules, which can be especially difficult.

The last three chapters of the book cover some interesting and worthwhile topics: JavaScript, file management, and installation profiles. Readers learn how to add JavaScript and CSS to a site, how to use the Drupal Library API, and related matters. Sadly, readers may be perplexed by the numerous poorly-constructed sentences — especially near the beginning Chapter 10 — such as "JavaScript within a group and within the sub-group of being or not being included in every page are ordered by weight" (page 291), which sounds like a joint effort by Hamlet and the IRS publications department. The next chapter demonstrates how to use the new files and images API that was introduced in Drupal 7, and which allows developers to reduce the number of contrib modules required for building even the most basic website. Confusingly, the reader is told that, when installing Drupal (presumably version 7), he will probably see three error messages resulting from missing sites/default/files directories; but I certainly did not see this when installing any of the beta or release candidate versions, nor heard this from anyone else. The authors also explain stream wrappers, the Image API, and image styles (and the effects they can utilize). The last chapter shows how to set up custom Drupal profiles, their tasks, and the distributions that can make use of them. The reader is told that "input formats" are now referred to as "text filters," but Drupal 7 appears to have standardized on the term "text formats." The book's two appendices discuss Drupal 7's improved database layer, and security techniques applicable to all versions.

Packt's website states that there are no known errata, so one can only assume that the publisher's editors failed to spot many obvious flaws: "a[n] introduction" (page 1), "eXtensible" (page 10), "However, Not" (page 16), "it's own data" (page 17), "though means" (page 18), "architecture advanced" (page 25; it presumably should read "advanced architecture"), "( a," (page 28), "an[d] equal sign" (29), "the the" (41 and 146), "exercising [of] every" (49), "test[,] absolutely" (53), "a child element[s]" (78), "its" (84; should read "their"), "short-coming" (85), "then" (90 and 98; should read "than"), "you will be passed to" (108), "lets" (120 and 129; should read "let's"), "FormsAPI" (235), "to post spam [to] the site" (254), "ever[y] page" (291), "html" (311; twice), "is to" (318; should read "to"), "how to we" (326), "let's make create" (326), "is [a] result" (365), and "many [of] types" (376). The reviewers section lacks page numbers, but does not lack errors: ", (," "and [a] bug," and "including[,] reviewing."

The writing quality varies from chapter to chapter, and some passages are awkwardly phrased and confusing, such as "each of these two lines were split on to one line" (page 57). Scattered throughout the book, one will find cases of semicolons used where dashes are called for, commas where semicolons are called for, title case used when inappropriate or missing when appropriate (the book's preface is a veritable minefield), compound adjectives missing hyphens, adjectives incorrectly tied to nouns using hyphens, needed commas missing (Appendix A has some egregious examples), and the term "was" used where the subjunctive "were" is called for — in other words, the usual grammatical flaws found in books written by techies. Fortunately, the material is livened up with a few welcome bits of humor, and not the overreaching kind found in many programming books. Even more admirable is the attention to internationalization, unit testing, and other good practices.

The example code within the text may be intimidating to those new to Drupal, but it really helps demonstrate the concepts discussed in the text. The downloadable source code is helpful for avoiding retyping that code from the text, but needs to be cleaned up. For instance, the code for Chapter 4 is in a directory named "1162_04_All code," which suggests that it contains all three versions, but it does not. The code for Chapter 5 is split between a subdirectory named "old," which contains the newest code, and in another directory, "1162_05," which contains older code. The directory "1162_07_Code" contains no fewer than six different (and possibly differing) copies of its example module. How can the reader know which is the correct copy to use for following the book's discussion? Moreover, for some of the chapters, such as 5, the source code listed and discussed in the book does not fully match that provided in the downloadable archive file.

Overall, this book is a substantial contribution to the Drupal literature, but it is weakened by two obvious problems: Firstly, it lacks a chapter or appendix to explain how the reader could contribute a newly-created module to the Drupal community — specifically, Drupal.org's Modules section. This is a glaring omission, particularly in light of the (laudable) encouragement to the reader to participate in the community, as well as the authors' many contributions to the same. Secondly, because this book is supposedly suitable for Drupal beginners, and given the complexity of Drupal's APIs and their code requirements, the authors should have presented the concepts in more digestible chunks, at a slower pace, so as to be easily comprehended by someone new to Drupal programming using APIs. This is especially true of the second and third chapters.

The aforementioned problems could be corrected in a subsequent edition, which would be well worth the effort: Drupal 7 Module Development is an information-packed and wide-ranging resource for experienced Drupal programmers who want to enhance their existing module-building skills, and transfer them to version 7.

Michael J. Ross is a freelance Web developer and writer."
Book Reviews

Submission + - MySQL 5.1 Plugin Development

coder4hire writes: If you were to ask some database developers to cite their favorite strategies for expanding the functionality of the relational database management systems with which they work, you would probably hear a variety of answers. One individual might recommend the use of an alternate database engine optimized for the given application. Another might explain the many advantages of using stored procedures to replace SQL queries embedded in the source code of any programs that connect to databases. But one answer you likely would not receive involves changing the internals of the database engine itself. With the latest major release of MySQL, developers using that particular RDBMS are now able to extend the capabilities of the built-in database engines, by creating plug-ins. This is the topic of a book by Sergei Golubchik and Andrew Hutchings: MySQL 5.1 Plugin Development.

This title was released by Packt Publishing on 26 August 2010, under the ISBN 978-1849510608. On the publisher's page for the book, visitors will find a detailed description, the table of contents, a sample chapter (the fourth one in the book, "Information Schema Plugins," as a PDF file), and links to purchase the print and/or electronic versions of the book. There is also a link for downloading all of the sample code used in the book, except for the commands found in the first chapter. The sample code is sufficient to demonstrate the complexity of the subject area, and thus it is good that both authors possess a lot of experience in all of the primary technologies discussed in the book — particularly MySQL. In fact, Sergei Golubchik was one of the principal architects of the MySQL Plug-in application programming interface (API). Incidentally, in the "About the Authors" section, we read that he "has continued as a MySQL AB employee since 2000," which makes it sound as though he is still employed there (now Oracle); but then we are told that he resigned to join a startup firm, which is a bit confusing.

The book spans 288 pages, most of which are organized into ten chapters, followed by an appendix and an index. The first chapter explains the details of how to compile, link, and install MySQL User Defined Functions (UDFs), as well as proper MySQL plug-ins. For those people working on Windows platforms, numerous screenshots are provided, showing how to work with Microsoft Visual Studio (which is freely available). Readers learn how to use MySQL command-line utilities for building and packaging plug-ins, and the options needed to do so. The subsequent chapter focuses on UDFs — both normal and aggregate ones — which are technically not part of the MySQL Plugin API, although they may be in the future. However, they can be thought of as precursors to true plug-ins, because they are written in C/C++, loaded dynamically at runtime, and extend the capabilities of the MySQL server — in this case, by being callable from within SQL statements. The authors explicate how to install and utilize UDFs, and provide several examples.

The book's remaining chapters explore different types of plug-ins, starting with the most basic kind of all, Daemon plug-ins, which can run code utilizing a dedicated thread in the mysqld server process. Readers are shown how Daemon plug-ins are structured — including their declarations, types, status variables, and configuration system variables. To demonstrate these components, the authors dissect four separate sample plug-ins, line by line, with a great deal of helpful commentary. The next two chapters, 4 and 5, delve into schema-related plug-ins, starting with those that create tables, and ending with more advanced topics, such as how to access and output information about a server's internal data structures. These two chapters present almost half a dozen examples, as equally detailed as those of the earlier material.

During the past several years, all relational database systems are seeing increased use of full-text parsing, for various purposes. Chapters 6 and 7 show the reader how to create plug-ins that supplement the full-text search capabilities already baked into MySQL. The first sample plug-in presented by the authors could be used by PHP programmers for parsing their scripts, while another sample could be used by developers who need to match user input (which may include typos), using a Soundex algorithm. The final three chapters cover many aspects of storage engines, ranging from a basic read-only engine to a more complex one that supports indexes. The book concludes with an appendix that surveys the primary enhancements to the Plug-in API that database developers may see in versions of MySQL after 5.1.

On the publisher's site, there are no reported errata, but here are some that I found in just the first couple pages, to get the list started: "class [a] to" (page 1), "on [a] MySQL fork" (page 2), and "ask [the] questions" (page 2). Also, countless phrases and sentences in the book are oddly constructed, with multi-word adjectives missing hyphens, commas used where semicolons are called for, and sometimes both mistakes committed in the same sentence, such as the very first sentence of the preface. In fact, the lead author admits that he prefers reading fiction to a dictionary. Regardless, the information and instruction provided by the authors are generally clear to the reader, and ably illustrated with the sample code.

The book and thus the reader benefit greatly from the extensive MySQL experience and knowledge of the authors, reflected in the depth of coverage of the various topics. MySQL 5.1 Plugin Development brings together valuable information that is otherwise tedious to find — scattered throughout the API source code, official documentation, and online forum threads. For any programmer interested in unleashing the full potential of their MySQL servers through the creation and use of plug-ins, this book is an essential resource.

Michael J. Ross is a freelance website developer and writer.
Books

Submission + - Drupal e-commerce with Ubercart 2.x

coder4hire writes: In the past, a Web developer tasked with building an online store would most likely do so using a dedicated e-commerce system, instead of a content management system (CMS), because even though the leading CMSs offered more features and flexibility, they did not provide robust e-commerce capabilities, such as product listings, bulk import, pricing in multiple currencies, a built-in shopping cart, and integration with tax and shipping information sources. Since that time, e-commerce systems have become more like CMSs, by adding features such as blogging and forums. At the same time, CMSs are continually expanding their e-commerce potential, usually in the form of developers adding plug-ins. For developers using Drupal, there traditionally have been two major e-commerce plug-ins (known as "modules"): Ubercart and e-Commerce. The former has emerged as the leader, and is explored in Drupal e-commerce with Ubercart 2.x.

This book was published by Packt Publishing on 22 March 2010, under the ISBN 978-1847199201. (My thanks to the publisher for a review copy of the book.) On the publisher's page, visitors will find detailed information about the book, a table of contents, a sample chapter in PDF format (Chapter 9, "User Interface Enhancement Techniques"), errata (only three reported as of this writing), and links to purchase either the print or electronic versions of the book, or both at a large discount. The authors of this title, George Papadongonas and Yiannis Doxaras, are experienced open-source developers. They both reside in Greece, which may explain why the reader will stumble upon — and sometimes over — many oddly-formed phrases throughout the book, as though they had been written in a foreign language initially, and then translated into English. More on that later. Nonetheless, almost all of the material presented within the 364 pages can be clearly understood by anyone who is comfortable with the basic terminology of e-commerce and Drupal. The authors have their own website for the book, yet oddly it isn't mentioned anywhere in the text.

The book is organized into ten chapters and three appendices. The first chapter is a brief introduction to Drupal, Ubercart, and the test case used in the early chapters — in this case, a store selling electronics online. Chapter 2 explains how to install the minimum required Web technologies, Drupal, Ubercart, and related contrib modules — either individually or using packages such as XAMPP for the Web server and the UberDrupal installation profile for Ubercart. The authors recommend the use of the Thickbox module for lightbox functionality, but that one has since been superseded by the Colorbox module. The reader is told that the extra modules listed on pages 34-35 do not need to be installed immediately, but will be installed in each chapter as required; but this is misleading, because in later chapters the readers will discover repeatedly that they were not told when to install the modules. Readers may be puzzled as to whether or not they are expected by the authors to use UberDrupal, but it is of no consequence, because the end result is the same, namely, the Ubercart site is ready for configuration.

The third chapter covers basic configuration of both Drupal and Ubercart, and begins with a thorough introduction to the admin area of Drupal. Experienced Drupal users could skip most of the first three chapters — aside from the list of needed contrib modules on pages 31 and 32. In the brief section on downloading and installing Ubercart, the authors advise the reader to enable the core modules, but unfortunately provide no guidance on any of the optional ones that should be enabled so the reader can easily follow the test case in the book. The reference on page 48 to "path/x" (where x is a node identifier) is perplexing, because the authors fail to explain what they mean by 'path', since its literal use is invalid, and no directory path is presented. Also, they state that the default Drupal temporary directory (/tmp) does not need to be changed, but that is not true for Windows users who want to use an existing directory, such as C:\DOCUME~1\[username]\LOCALS~1\Temp (where [username] is their current Windows username). The cart settings on page 55 show four panes, instead of the two that will be seen by readers who have followed the authors' instructions exactly up to this point. A similar problem is encountered on page 65, because the text assumes that the reader has enabled product kits, although Chapter 2 recommended otherwise. The "Product features" pane is skipped, without any apparent reason. In general, the authors' coverage of the configuration settings provide little information beyond what is already explained on the settings forms themselves; this chapter would have been much more beneficial had the authors explored the typical cases in which the reader would want to change the settings, and the benefits of doing so.

The material becomes more interesting with Chapter 4, which gets into the details of managing categories, subcategories, products, and attributes. The authors begin by showing how to enhance products using both admin-created and user-generated tags for products and product kits. Yet in describing the latter type, a critical step in the process is neglected, namely, enabling the "Tags" setting. The reader is then told to create a couple sample products, and combine them into a product kit, which is a straightforward process in Ubercart — although some readers may initially be puzzled by the instructions to go to a Web page on the site http://www.mysite.com/ (also on page 106). More odd is the example product kit having a name of just a single component and a description consisting only of the other component's name. Readers learn how to bulk import a large amount of product data. In the process, we are instructed to "enable this module" (page 89), when actually all three modules need to be enabled. Also, no reason is given as to why the authors opted for the directory name "import" over the module's better default of "imports." The second figure on page 97 shows the first imported record not as a formatted product entry, but as PHP code, which is probably not what was intended. The next topic — product attributes — is important, because any shopping cart system that lacks flexible and powerful attribute management capabilities may appear at first glance to be a workable choice for creating an online store, but eventually those deficiencies will make it difficult if not impossible to implement the e-commerce setup desired by the store owner. The chapter is wrapped up with a brief but valuable description of the three ways to manage the products in an Ubercart site.

When it comes to shipping and packaging — the focus of Chapter 5 — far too many shopping cart systems burden the store admin with limited options and non-intuitive interfaces. Ubercart is relatively more straightforward, and the book shows how to specify destination countries, conditional actions, and shipping quotes — using flat rates, product weight, UPS, and USPS. Unfortunately, conditional actions are given little attention, and even the sample scenario is not demonstrated. This is a shame, because the topic is critical to developing an Ubercart-based store so it will automatically perform actions — such as notifying the customer — based upon a wide range of common events and conditions. Anyone planning on using the UPS shipping method should note that the registration URL provided has changed since publication of the book, but does point to the UPS Developer Kit, which has a registration link and other resources. The last section, on weight quotes, could prove baffling, because it does not match the current behavior of Ubercart in defining such a shipping method.

Properly calculating the appropriate taxes for customer orders, and accepting payments online, are two areas of e-commerce fraught with potential problems, and even greater legal risks. These are explored in the sixth chapter, which gets off to a shaky start with the claim that the overview page for "Tax rates and settings" has policies already configured, when in fact there are none. Readers learn about tax rates within Ubercart, payment workflow options, advantages and disadvantages of accepting credit cards on one's site, the configuration of payment settings, and details on the Ubercart modules available for the major gateway services — with an emphasis upon PayPal and Google Checkout. Oddly, the authors recommend that merchants outside of the United States and UK obtain VAT numbers, even though the former country does not have a value-added tax (at least, not yet). The chapter concludes with a brief overview of how to create your own payment gateway module. The authors mention that they are providing the reader with code samples for two of the most common payment gateway request methods, and yet there is no such code in the chapter, and the book has no downloadable code on the Packt Publishing website.

Chapter 7 looks at the related topics of customer management; order tracking, workflow, search, creation, and modification; and invoicing, payments, packaging, and shipping. Merchants will find much of this information collected into the reports built into Ubercart. Yet more thought should have been put into the diagrams, such as the one on page 160, which includes an unexplained asterisk in one status box, and an order going from the status of "product gathering" to a second status with the identical name. Also, the process of creating a new order as described does not match the current interface in Ubercart 2.4 (the current version as of this writing). The chapter continues with summaries of customer relationship management (CRM) in general, and CiviCRM in particular, and how it can be integrated into an Ubercart site. The authors state that the Ubercart Wish List module is part of the Ubercart "extra" list of submodules, but it is instead a separate project. Other methods of increasing sales are discussed, including newsletters, company blogs, discussion forums, and Twitter.

In some respects, the remaining three chapters can be thought of as a second part of the book, because they presume that you have completed all of the elementary components of your online store, and are now ready to customize its appearance, and begin marketing the site. Chapter 8 elucidates how to find, install, and modify a Drupal theme for your needs — as well as how to create your own, based upon the popular Zen and Fusion starter themes. The material is generally clear, except for the authors' claims that site visitors cannot "perform proper searches" using the default Drupal 6 theme (Garland), and that you the site creator "cannot interfere with UI" (whatever that means). Confusingly, pages 200 and 201 list all sorts of advanced theme configuration settings for Garland which don't exist. The chapter finishes with a demonstration of how to create a new Drupal theme from either a static HTML site or a Photoshop template (despite an earlier claim that the chapter would end with a reference to the Fusion Theming System, which is absent).

Chapter 9, "User Interface Enhancement Techniques," shows you how to improve an Ubercart-based site using taxonomies and recommendation systems (for product cross-selling), the Panels and Views modules (for greater flexibility in information display), discounts, and other techniques. This discussion has more wheat than chaff versus the earlier chapters, probably because the authors are exploring higher-level methods, and not stepping the reader through forms. But again, configuration settings are mentioned that will not be seen by the reader, evidently because the authors do not provide timely instructions as to the modules to install and enable, such as XML Sitemap (page 231).

The final chapter first explores a host of Drupal contrib modules aimed at online promotion, and then shows how to improve a site's security with backups, security reviews, and spam blocking. The final material comprises three appendices, covering a hotel booking system, lists of the modules used in the book, and some of the free and paid themes suitable for an Ubercart site.

The book contains numerous errata: "contributed systems" (page 1; should read "contributed modules"), "innovated" (page 7; should read "innovative"), "constrains" (page 7; should read "constraints"), "hundreds and thousands" (page 8; should read "hundreds of thousands"), "It is [a] social media ready" (page 8), "brooking" (page 10), "flash animated" (page 10; should read "Flash-animated"), "depreciated" (page 20; should read "deprecated"), "[the] Drupal installer" (page 27 twice, and 28), "[the] time zone" (30), "their home page[s]" (32), "to [the] site" (48), "such [a] service" (58), "customer [to] enter" (65), "ipod" (80), ."com//node" (86), "types or files" (88; should read "types of files"), "know, exactly" (106), "it it" (111), ", [the] shipping rate" (112), "charge[s] you" (128), "customers['] geographic locations" (132), "statements[,] discussed" (134), "logics" (134). That last one — an amusing non-word — seemed a "logical" and thus appropriate place to stop recording errata, even though I had yet to reach the halfway point in the book.

Earlier I noted that many of the phrases — and entire sentences — are awkwardly constructed. A few of them are unintentionally humorous, such as the phrase "to mess with" getting turned into "to mess up with" (page 205), and the phrase "a check for the balance" getting shredded into "a balanced check" (page 147) — which immediately brings to mind the question, What would be an unbalanced check? This problem worsens as the book progresses; by page 244, "caching time" has been shortchanged into "cashing time," and "number-one ally" has melted into "number-one alloy" (page 292). Some of the problems are present in all the chapters. For example, in countless places, the words "the" and "a" are needed but missing. While programming books generally are known for being grammatically and stylistically weak, there is no excuse for releasing a book to press that has not been thoroughly proofread. The same is true with regards to the technical editing of such a volume prior to publication. Throughout the book, URLs are missing the root directory "/" (which generates an error from the server). In most if not all places where the reader is told to leave a page's settings unchanged, he is then told to click the "Save configuration" button (before going on to the next page) — which is completely unnecessary and a waste of time.

But these are not the flaws of greatest importance. There is too much emphasis throughout this book on how to fill out form fields that are fairly obvious, and yet the most important subject matter is oftentimes glossed over. For instance, the topic of conditional actions arguably deserves its own chapter, or at least an extended section — not one and a half pages up front, and then several paragraphs later. A few key e-commerce topics are absent. A glaring example of this is the lack of discussion of how to sell digital products in one's store, which nowadays is important enough to warrant its own chapter. Subscription services (typically with recurring payments) is another worthy topic completely skipped. These deficiencies may be due to the authors' focus on explaining the admin pages and settings found within the basic Ubercart modules, rather than a much more pragmatic approach of exploring the steps needed to reach a goal (e.g., selling downloadable files) regardless of what modules are utilized. Admittedly, Ubercart and all of its constituent modules comprise enough details and moving parts that could justify a book of greater length. Yet room could have been made for those details and advanced topics by spending less time describing (obvious) form fields. Lastly, if the authors had expected the reader to be able to follow their instructions throughout the book, they should have made it more clear as to which modules and options should be enabled at each step.

Nonetheless, the authors have clearly put a lot of effort into making what could be an extremely dry subject more approachable, as they take the reader through the major phases of building a typical online store for selling physical goods. Offering complete explanations and plenty of screenshots, this book could be a valuable resource — as both tutorial and reference — for Web designers, developers, business owners, and anyone else involved in creating a Drupal/Ubercart e-commerce website.

Michael J. Ross is a freelance website developer and writer.
Book Reviews

Submission + - jQuery Cookbook

coder4hire writes: Like all major programming languages, JavaScript can be extended in functionality through the use of libraries, such as jQuery, which is currently seeing tremendous popularity and enhancement in the Web development community. Designers and developers who want to learn how to use jQuery for creating rich user interfaces through client-side JavaScript, are advised to begin their journey to jQuery proficiency by reading one of the many books dedicated to this powerful JavaScript resource — such as jQuery Cookbook: Solutions & Examples for jQuery Developers.

This book was published by O'Reilly Media on 19 November 2009, under the ISBN 978-0596159771, and is authored by no fewer than 19 contributors — all quite knowledgeable of JavaScript and jQuery — and edited by one of those contributors, Cody Lindley. On the publisher's page for the book, visitors can read the book's description, table of contents, and errata, of which there are 22 as of this writing, although none have been confirmed by the authors or publisher. Visitors can also download all of the sample code used in the book, in addition to the eight code demos for Chapter 13. Lastly, prospective buyers can purchase the print version of the book, the electronic one (in PDF, ePub, and Mobi format), or the two combined at a considerable discount — or read the book as part of Safari Books Online.

jQuery Cookbook's 480 pages are organized into 18 chapters, covering a wide range of topics: the basics, element selection, utilities, dimensions, effects, events, forms, plug-ins, user interfaces, theming, Ajax, data formats, and testing. Lindley starts off the first chapter, titled "jQuery Basics," by presenting the advantages, philosophy, and organization of jQuery. Readers will likely chuckle at his suggestion that they memorize the jQuery API outline, which comprises two pages. The many code snippets are quite helpful, but they are needlessly long, partly because most of them contain far more HTML elements than are needed to illustrate the point, and also because each snippet contains the DOCTYPE and head tags, among others — often taking up more lines on the page than does the code pertinent to the topic at hand. This pointless and space-wasting redundancy is seen also in a few of the chapters that follow. As well, some of the passages in the first chapter's narrative are oddly phrased, frequently requiring a rereading of the material, while others could be made more concise. Additionally, some of the sample code contains bugs, which fortunately are detailed on the errata page mentioned earlier. The second chapter, "Selecting Elements with jQuery," presents numerous techniques for specifying elements within the DOM. The only obvious blemish in the material is in section 2.4, where the author refers to animated elements, but with absolutely no explanation as to what that means; countless new readers may assume he is referring to animated GIFs. Nonetheless, these two chapters form a helpful foundation for the rest of the manuscript.

The third chapter, "Beyond the Basics," gets off to a questionable start with the assertion that "jQuery can [] extend jQuery to infinite possibilities," which sounds like a line wisely rejected for the movie Toy Story. Yet the discussion continues on a solid footing, as it covers more advanced techniques for working with selected elements. Some of the discussion overlaps material presented in the previous two chapters, but it is always worthwhile to hear critical concepts explained from a different perspective. However, section 3.8, which briefly introduces jQuery plug-ins, is out of place; that material should be folded into Chapter 12, which focuses on that topic. The fourth chapter may be brief, but it explains several jQuery utility methods. Most of the code snippets use a format of "(function($) (jQuery);" — whose usage and advantages are not explained in this chapter, nor any earlier ones. This points up one of the key downsides of having almost every chapter of a programming book written by separate authors: readers can be confused or misled by disparities in coding practices, especially when the reasoning behind them is not given. The title of the fifth chapter, "Faster, Simpler, More Fun," is a bit misleading, because the authors don't explain how to make one's jQuery programming simpler or more fun, but they do provide a great deal of information on troubleshooting, performance optimization, and jQuery coding practices, including those pertaining to progressive enhancement, accessibility, and unobtrusiveness. Section 5.19 lacks a figure showing the menu being discussed, but that's the only obvious flaw.

The remaining chapters are dedicated to more specific aspects of jQuery programming, including the important topics of page layout as well as element positioning and sizing, discussed in Chapter 6. The subsequent chapter delves into effects, which is one of the more exciting topics in the jQuery realm. Even though a portion of the readers may be put off by the trickiness of the code, the material does demonstrate some of the powerful capabilities of jQuery effects — which in conjunction with HTML5 may easily encroach on areas of client-side programming formerly dominated by Adobe Flash. Throughout Chapter 7, most if not all places where the author refers to the "mouse," he apparently means the "mouse pointer." Events play a critical role in JavaScript software, and even more so for code that is mostly jQuery — thus the value of chapters 8 and 9, which examine basic and advanced event handling. The next pair of chapters discuss a variety of techniques for enhancing HTML forms, from scratch and through the use of jQuery plug-ins. The sample source code is better commented than what is seen elsewhere in the book, and the explanations are quite good. The subsequent chapter focuses on jQuery plug-ins, beyond their usage within HTML forms, and briefly explains how to create your own plug-ins and how to perform unit testing on them.

Because JavaScript is primarily a client-side technology, it should come as no surprise that jQuery can prove an outstanding tool in crafting user interfaces for Web sites and Web-based applications. Chapters 13 through 15 explore such topics as drop-down menus, sliding panels, rotating images, modal windows, tooltips, the jQuery UI, and how to style jQuery UI widgets, a.k.a., theming. No Web interface is an island, and over the years there have emerged a number of data formats and protocols for utilizing those formats for transmitting information between browsers and servers — such as Ajax, XML, JSON, and JSONP — covered in Chapter 16. Finally, the last two chapters of the book are geared more to testing and deployment, and less so to interface design and development. The topics covered include techniques for persisting data in the browser, managing large amounts of code and data for major software projects, automating the unit testing of jQuery code, testing callbacks and user actions, grouping and selecting tests, and more.

Overall, jQuery Cookbook starts off with some basics, and only then moves on to higher-level concepts and related use cases. However, the book is ostensibly aimed at beginners and intermediate JavaScript programmers, but the former group may find the ideas difficult to grasp fully, despite the introductory chapters — because some of the techniques are fairly advanced, they involve terminology unfamiliar to anyone new to jQuery, and some of that terminology is not explained. On the other hand, the recipes are generally well written and clear, supplemented with properly tested and working code. Consequently, anyone who takes the time to work through the examples patiently, should be well rewarded.

Because of its coverage of a wide range of topics, jQuery Cookbook can be used not only as a learning aid, but in some respects also as a reference — and in this regard the book's index will be quite useful. In light of the considerable length of the manuscript, reading it from stem to stern would involve an investment of time — especially if one were to work through all of the examples and try them out in one's own development environment — quite easily, in fact, since all of it can be downloaded from the publisher's site. Most of it, however, is organized as plain text files, and not HTML files; and no reason is provided for this annoying choice.

In terms of the layout and appearance of the text and figures, one flaw is that in countless lines throughout the book, the words are jammed together, making it difficult to read the text rapidly. In fact, some of these lines almost look like single words. This is also seen in the subheads, an excellent example of which can be found on page 149: "Solution2:ChangingthehrefAttributeoftheStylesheetThat'sResponsible." Unfortunately, the same is true for much of the source code, but in a different sense: Operators and variables are jammed together, clearly illustrating the need for whitespace in making code more readable. Some of the code is excessively long (noted earlier), and the authors are inconsistent as to whether their JavaScript is placed at the end of the body element or in the header element. Nonetheless, the sample code is generally of good quality.

There is another aspect related to not only this book but all other computer programming books for which individual chapters are written by different authors: jQuery Cookbook does not seem to be a single book, but instead a collection of books that were bundled together because of a common thread, namely, jQuery. This leads to some of the problems mentioned earlier, such as discrepancies in coding techniques and formatting — from which the beginning reader is supposedly learning best practices. On the other hand, the multi-author approach makes it possible for each major subject area to be handled by one or more writers who are expert in that particular area — which in turn results in a better product overall, even if one or two of the chapters are noticeably weaker than the others.

The book contains a number of copyediting flaws not listed on the aforementioned errata page: "elevated" should instead read "alleviated" (page 12); "or [its] alias" (13); "could change" should read "could be changed" (26); "jQuery('a')removeAttr('title')" is missing a "." (30); "'blue')" is missing a terminating ";" (50); "season in" should read "season" (56); "was contained" should read "is contained" (144); "position: absolute" in the narrative should not be broken between two lines (156); "great[er] than" (157); "equal[-]sized panels" (160); "only running" should read "only runs" (165); "still support[s]" (168), "#source5txt" should read "#source4txt" (217); and at this point I stopped recording errata. Also, in countless places in most of the chapters, semicolons are used where dashes are called for, and vice versa. O'Reilly's copyeditors should have detected and fixed those errors prior to publication.

Yet most of these blemishes are of little significance. What really counts is the overall value provided to the reader: Usable for both learning and reference, jQuery Cookbook delivers a tasty buffet of programming essentials, best practices, illustrative examples, optimization tips, and other information of value to JavaScript developers who wish to spice up their Web creations with jQuery.

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

Slashdot Top Deals

Math is like love -- a simple idea but it can get complicated. -- R. Drabek

Working...