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

Can a single book get web designers to start writing better, reusable PHP code? Peter Lavin makes a go of it in Object Oriented PHP, and it comes out pretty darn well.

 

The gist of the book is this: would you rather write code that does the same sort of stuff over and over and over and over and... so on and so forth, or would you rather write a piece of code you can plug into any of your pages or sites when you need to do a certain thing? The object-oriented way involves a little more time upfront, but it pays off time and time again. Because, let's face it, none of us enjoys coding the same boring stuff unless we're gluttons for punishment.

Some may say, "What?! What's this nonsense about OOP with PHP?" —  and I will duly point them to the specs for PHP 5. That's when OOP techniques were truly made possible. I tell you, even I started reading Peter's book with skepticism, because heck, PHP is "just" a scripting language, and besides, Dreamweaver can write a lot of the code I need for myself.

But as I went through the book, I realized an object-oriented approach is a scalable approach. It can be applied to multiple projects. In essence, that's what Dreamweaver's doing when I tell it to write a recordset for me, and Macromedia's not doing too bad as a company... There are obviously benefits to be reaped from OOP in web development.

Lavin's book is great, because it walks you through and explains how OOP in PHP should work. He first explains the basics of OOP, then applies them to PHP, and provides real-world techniques and code to illustrate his points. He touches on AJAX, XML, RSS, thumbnail images, PDO, and other cool things in an approachable and understandable manner.

It's funny, but the illustration on the cover of the book says it all. Would you rather code a waffle from scratch, or code the wafflemaker, and make yourself waffles whenever you want them? That's the difference between just writing code and object-oriented programming. It gives you the power of reproducibility and scalability. So what are you waiting for? Get cooking with OOP!

Article tags

Spread the word
Bookmark and Share
Profile image for raoul-pop

Article Author: Raoul Pop

I'm a web developer, blogger and photographer. I write daily about technology, photography, travel and other interesting things on my site. I invite you to subscribe to my RSS feed and follow my work.

Visit Raoul Pop's author pageRaoul Pop's Blog

Read comments on this article, and add some feedback of your own

Article comments

  • 1 - Tom Minderson

    Dec 24, 2007 at 1:31 am

    "Reuse" has fallen out of favor as OOP's top selling point. And frankly, I don't know what the new selling point really is. Over time, OO proponents seems to slip further and further into subjective and evasive claims, sounding more and more like the cheesy eastern philosophy on the Kung Fu TV series. Reductionist science and OO seem worlds apart.

    But if you want to stick with "reuse" as the primary claim of OOP, I challenge you to create a practicaly reusability code sample that procedural/relational cannot match. (Hint: in the real world, variations-on-a-theme rarely slice down nicely as a tree taxonomy over the longer run.)

Add your comment, speak your mind

Personal attacks are NOT allowed.
Please read our comment policy.
Please preview your comment.

blogcritics lists for Nov 12, 2009

fresh articles Most recent articles site-wide

fresh comments Most recent comments site-wide

most comments Most comments in 24hrs

top writers Most prolific Blogcritics for October

top commenters Most prolific Commenters in 24 hrs