Learning PHP, MySQL, JavaScript, CSS, & HTML5, by Robin Nixon (3rd ed., O’Reilly, 2014)

If you work around your house or mess with electronics, you come to have a sentimental attachment to your toolbox (or at least I do). You and your toolbox have seen a lot together. More than this, there’s a practicality to your toolbox: in a small space, you have a lot of what you need to handle a variety of situations. Robin Nixon’s Learning PHP, MySQL, JavaScript, CSS, & HTML5 is the web programming equivalent of a well-stocked toolbox. It’s not going to have what you need for all possible situations as a web programmer, but it packs a lot of utility into a compact space.

The core of the book is Nixon’s concise coverage of the basics of PHP, MySQL, and JavaScript. The book then delves into each of these topics in a further chapter or two– giving some further ways to use PHP, or tips on working with MySQL databases. Along the way, Nixon covers many of the most common ways readers are likely to want to use these tools: working with forms, cookies, sessions, and authentication, for example. For such a comprehensive book, it does an admirable job of thoroughly explaining topics (such as AJAX) that other books often skim over with a few code snippets. The coverage of topics as substantial as these in a single book enforces brevity, and might suggest that topics get less coverage than they merit. It is to Nixon’s great credit, I think, that there are far fewer gaps than one might expect. The only really egregious one, to my mind, is that jQuery only merits a brief mention (on p. 420).

The second major part of the book moves from the web programming side of things to consider CSS and HTML5. Aspiring web designers should be aware that– despite the book’s occasional claims to be for those who want to learn how to “style and lay out” web pages (p. xxii)– this is not the book from which to learn the nuances of web design with CSS and HTML5. The book does not cover the new semantic elements in HTML5 (though an explanation for this is given on p. 601), nor does it cover all of web design’s intricacies (divs, spans, floats). The book’s chapters on CSS could serve as a helpful primer or refresher for the web programmer who needs to do some light web design work, though. The coverage of CSS3 and HTML5 is good; Nixon discusses many of the ways that HTML5 and CSS3 are changing (and often simplifying) the way to do things on the web, from streamlining layout and display to displaying audio and video, while still explaining how to support older browsers.

This may not be the final word on web programming– given how much things are in transition at the moment, it is hard to know how any single book could be– but as an introduction and a practical set of tools, this book is nevertheless recommended.

Advertisements

Building Web Apps with WordPress, by Messenlehner and Coleman (O’Reilly, 2014)

Writers of books on WordPress are presented with a bit of a quandary, I think. On the one hand, one of the best resources for working with WordPress is the WordPress Codex itself, which is free, complete, regularly updated, and can cover a lot more territory than neatly fits within the covers of any one book. On the other hand, writers of WordPress books have to contend with the fact that a phenomenal book on WordPress already exists, Williams, Damstra, and Stern’s Professional WordPress: Design and Development. Messenlehner and Coleman’s Building Web Apps with WordPress enters this crowded field and acquits itself reasonably well. It’s no Professional WordPress, and it’s not the book it might have been, but it is a solid addition.

The book covers a lot of territory, starting from the basics of WordPress as a CMS and an app platform all the way to how to optimize your WordPress performance. The basic idea of the book, then, is that it will take you from some basic understanding of WordPress and WordPress plugins through to scaling and optimizing your wildly successful app in a production environment. Early chapters introduce WordPress and give some rough idea of how it works. Chapters 4 through 8 are the core of the book, and cover themes, custom post types, users and roles, other miscellaneous APIs and objects, and security. Later chapters introduce more specialized, supplementary topics such as mobile WordPress apps, and ecommerce apps.

Despite the clear layout of the chapters, the organization could be better, and important material is hidden in unexpected places. For example, the section of chapter 5 on custom post types does not actually cover the functions used to work with post metadata. Fundamental concepts like the loop, hooks, and the standard WordPress global variables are not in chapter 2, on WordPress Basics, but buried in Chapter 3, on Leveraging WordPress Plugins.

The quality of the chapters varies. Some chapters of the book are introductory overviews while others are advanced discussions; some are crammed full of advice, insight, and helpful code examples while others are essentially a function reference (a wider failing of PHP books, in my experience). Thorough, insightful discussions of WordPress development are scattered through the book: their comparison of custom taxonomies and post metadata in chapter 5, for example, is one of the best discussions I’ve seen. In general, though, I think the book is hampered by the decision to make it cover WordPress from basics to advanced topics. This means that the book competes with Professional WordPress on its own turf (not to mention a whole host of other books that cover the basics of WordPress), rather than striking out for fresher territory.

Messenlehner and Coleman do have experience designing and building apps, and it would have been interesting to get a deeper perspective on the nuances of WordPress app development. For one, there are a range of ways to interact with your data in WordPress, everything from the WP_Query class to the $wpdb object to using custom tables. Some of this is touched on, in chapter 3 and much later in chapter 16. But the commitment of the book to the whole basics-to-advanced gamut means that these discussions are less sustained, and less helpful, than they might have been if they had just dropped the pretense. This might also help to resolve some of the organizational problems the book has: they discuss working with custom tables in chapter 3, but the full explanation doesn’t come until chapter 16. (Part of the explanation has to do with performance when querying post metadata, which is not discussed in the discussions of post metadata in chapters 2 and 5.)

For similar reasons, the book uses a single app as the example throughout the book (their Schoolpress app). As a number of reviewers on Amazon have pointed out, this sample app is not in fact complete (in private beta, at the moment), nor is the code up on github. If this app was in the early design stages when the book was written, one possibility would have been to give more thorough consideration to a range of examples, a range of design possibilities: an app where much of the work is in the theme, and the code in the functions.php file; a middle-of-the-road app, with some custom post types; and a very complex app like Schoolpress. I don’t think the fact that the Schoolpress app is incomplete is entirely fatal, but it seems like a missed opportunity: if the development process of Schoolpress hasn’t gone as smoothly as anticipated, the book might well have been enriched by the lessons of the development process.

Though I’ve dwelt on the book’s problems, the book contains insightful discussions of working with WordPress and making your app work well– though they may not be where you’d expect. With some reorganization, and a clearer sense of the book’s purpose, a second edition of this book may well earn a place next to Professional WordPress as an essential work for WordPress development.