PHP OOP for the Procedural PHP Programmer
I’ve been doing more and more PHP development lately. Along with other projects, I’ve been doing some ongoing development for one client and I’ve been having a lot of fun nailing down my personal style, figuring out my personal best practices.
I realized recently that I should be looking into object oriented programming, and deciding whether or not I should be integrating it into my programming practices. I cut my teeth on C programming back in the 80′s and my programming has always been procedural.
Fast forward 20 years and now OOP is the rage. If you don’t know how to do it, you’re not a real programmer. (Of course, most “real programmers” wouldn’t consider PHP development “real programming” anyway. There’s a definite hierarchy amongst programmers with regards to language and style.)
I did a lot of browsing and sampling different OOP books and online resources, and I have to say I was struck by how vague and haphazard were the terms and definitions most writers gave when attempting to explain OOP. I was unable to really understand OOP because the authors were as clear as mud. I kept looking.
I’m currently about a third of the way through “Object Oriented PHP Concepts, Techniques, and Code” by Peter Lavin, published by No Starch Press. It’s from 2006, so it might be a little dated as far as some of the technical specs of the latest version of PHP 5, but it explains terms like method and interface in clear language instead of vague, empty jargon. The author uses simple, practical, real-world examples to demonstrate the concepts.