Object-Oriented PHP: Concepts, Techniques and Code, by Peter Lavin, ISBN 1-59327-077-1

Reviewed by: Robert Boardman, August 2006
Published by: No Starch Press
Requires: N/A
MSRP: US$39.99, CAN$55.99

I reviewed this book not because I am a programmer, but because I develop and build web sites and because I am familiar with PHP. I hoped to advance my own knowledge of PHP and to be able to use the techniques described in the book to spread the use of PHP. The author, Peter Lavin, says in the introduction that this book, “will appeal to the developer who is familiar with PHP and wants to learn how to use its OO capabilities.” He assumes the reader is familiar with (X)HTML and CSS and either PHP or a language that uses C-type syntax. “Familiarity with relational databases, particularly MySQL is recommended.” So, review writing aside, I am part of the target audience.

The book consists of sixteen chapters plus two appendices. The first three chapters are very short, explaining the basics of object-oriented programming (OOP) and the features in PHP 5 that support OOP. Chapter 4 introduces the scenario, the “problem” used throughout the book and starts to solve that problem using PHP 4. Chapter 5 modifies the code built in chapter 5 using the OOP approach of PHP 5. It is not a big transition in coding and Lavin explains the steps clearly and carefully. Chapters 6 through 11 expand on the basics, adding classes, inheritance and some advanced concepts. Chapter 12 examines some newer Internet technologies such as RSS, AJAX and SOAP. Chapters 13 and 14 deal with magic methods and reflection classes. SQLite is included with PHP 5 so Lavin works with it in chapter 15. PHP Data Objects (PDO) is included with PHP 5.1 and higher and is discussed in chapter 16. PDO holds the promise of uniform access to any database. It may also degrade performance and complicate code. Lavin works with PDO as a possible answer to database interfacing, but strongly suggests that each developer will need to test it carefully and fully before implementing it. The two appendices have instructions for getting PHP 5 set up and for converting PHP 4 code to PHP 5.

 

This is an interesting and challenging book. The running scenario presented seems to be quite simple: in order to do some server clean up you want a list of all the graphics files in a particular directory, you need to see the files and the file names. After working through several versions of the code, it generates then displays thumbnail views of the images, with a preset number of images per page, and with a navigation tool. Along the way the reader learns about classes, methods and inheritance. Using a connection to a MySQL database, the author reuses the original code to display the result of a query, something like the on-screen result of a search in Google. The author also deals with catching errors and exceptions and implementing an interface. All of that is before the more advanced work in chapters 11 to 16.

At the time of writing this review there were three errors in the text posted on the web site. The site contains files with all of the code for the book, either in one large archive or chapter by chapter. Files are provided in both zip and tarball formats, so they should be usable on most computers.

Lavin’s writing is clear and concise. The book should be understood by most of the target audience. As I read the book I wished I was more familiar with OOP concepts. Common concepts in OOP are explained clearly, but very briefly, in chapter 2. However some of these concepts don't get used for several chapters. The Glossary is quite clear and useful. But sometimes I wished there was a sentence or two reminding me what a term meant at the point where it was put to work, not just a reference to a previous chapter. I expect the same will be true of someone with OOP experience but no PHP or HTML experience. There were not quite enough reminders about previous learning.

The book is designed for people who want to learn about the power of OOP using PHP. It is a little challenging, but learning anything new will be challenging. Lavin has focused on a highly useful area of knowledge for web developers and has done an excellent job. Recommended.

KSN Product Rating:

Comments? Questions? Qualms? Technical problems? Send an e-mail!

 

 

 

 




© Copyright 2000-2006 kickstartnews.com. All rights reserved. legal notice
home | previous reviews | hot news | about us | search | store | subscribe

 

Forums Search Home Previous Reviews About Us Store Subscribe