Reviews

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

“Object Oriented PHP: Concepts, Techniques and Code”, by Peter LavinCan 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 me. 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.

Peter’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!


Standard

2 thoughts on “Object-Oriented PHP: Concepts, Techniques, and Code by Peter Lavin

  1. I just started programming with PHP, and thought I might just as well start grasping OOP. I have a question cause I am not too experienced yet:
    In the three functions setHeight, setWidth and setColor, there’s a variable called $value. How does that variable get assigned it’s value in the three respective functions?

    Like

  2. Pingback: Book giveaway: Object-Oriented PHP, by Peter Lavin

Comments are closed.