19146572
submission
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.
17209466
submission
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.
16395452
submission
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.
11797418
submission
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.