LinuxWorld
Subscribe to this site with RSS

Book review: Object-oriented PHP

Understanding and using Object-Oriented Programming (OOP) even in scripting languages is becoming de rigueur these days. This book teaches PHP developers how to use OOP via a series of extremely practical examples.

"Object-Oriented PHP" by Peter Lavin teaches the fundamentals of object-oriented programming by guiding the reader through a series of inter-related example classes. There are two audiences that will benefit most from reading this book and working through the projects: primarily PHP developers who write procedural code but want to learn OOP, but also developers who use OOP in other languages but want to an introductory exploration of PHP.

Even experienced OO PHP folks will find this book of value because, beyond the primary core material that teaches OO, it touches on a variety of interesting additional topics such as PHP Data Objects (PDO), the Reflection classes and AJAX -- and because Lavin expertly explains sound programming techniques that may be new even to folks with OO experience under their belts.

Though the "Basics of OO Programming" chapter is too brief and wonder if someone brand new to OOP would get all the basics he needs from its scant five pages, that's one of my very few gripes about this fine book. I imagine the author chose to move very swiftly through the obligatory basics chapter, opting instead to introduce basic concepts as the book unfolds through the hands-on exercises. Overall, the book accomplishes what it sets out to do, and it does it well.

I especially like Lavin's choice of example classes. The tasks they perform, such as making image thumbnails, building navigation among multiple pages of data, and querying MySQL databases, are all wonderfully practical and are the types of things that frequently come up in the day-to-day life of a PHP developer.

Other highlights include a great section on documenting classes via the Reflection Classes, and good practical examples using SQLite, PDO, XML, RSS, AJAX and Google API.

The explanations of sample code are easy to follow because references to specific sections of code are visually marked by numbered dots within the code listings themselves, rather than relying, as most books do, on references to line numbers. Little touches like that and the lay-flat binding add to the overall quality of the book.

Invalid query - session: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Newsletter sign-up

Sign up for one of Network World's newsletters compliments of Linux World

Linux & Open Source News Alert
Web Applications Alert
Video and Podcast Alert
Security Alert
Virtualization Alert

Email Address: