Book Review – Object-Oriented PHP, Concepts, Techniques and Code by Peter Lavin

Book Review – Object-Oriented PHP, Concepts, Techniques and Code by Peter Lavin

Author:Peter Lavin
ISBN: 1593270771
Publisher: No Starch Press
216 pages
Published: June 2006

Object-Oriented PHP by Peter Lavin is a good book for any traditional/procedural PHP programmer who would like to know what those object-oriented PHP programmers are so excited about. If you are considering adding object-oriented PHP to your toolbox and want a step-by-step, example based guide for the beginner, this is a good book to start with. This book is also for programmers who want to switch from PHP 4 to PHP 5.

Lavin starts with an overview of object-oriented PHP and discusses several of its advantages. He then discusses the basics of object-oriented programming such as classes and inheritance and the specifics for this type of programming in PHP. Next, he teaches you how to write your first class. One of the nice things about this book is that the author starts with this simple example and, as you progress through the book, shows how to build upon, extend and reuse that simple class to do more advanced programming.

The first step is to extend this class into a directory item class that will list all the files in a directory or list just certain files as needed. Next, you will write a thumbnail class that will create thumbnail images on-the-fly that are reduce in dimensions and quality thus reducing the download time. The third class you write is a page navigation class, similar to that used by GoogleTM, that will control the number of items listed on a page and also the number of page links in the navigation. Finally, he shows you how these three classes work together and with CSS.

Next, Lavin discusses the MySQL database class and how it works with the MySQLR database. He also covers inheritance and how that can be applied to simplify error handling. He then moves on to abstract classes, magic methods and how dynamic websites can benefit from the SimpleXML extension to work with RSS feeds and the SOAP extension for a website search engine. We all hate to document our programs and Lavin shows you how to use the reflection class to self-document your code.

Peter Lavin has a web development firm and writes for several publications including PHP Hacks. There is a companion website that contains downloads of all the code and working examples.

This site needs an editor - click to learn more!

Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map

Content copyright © 2022 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.