Aug 25 2008

Object-Oriented Programming with PHP5

So as some of you already know, in my venture to keep up on the development community and trends, I have started to review books for Packt Publishing. They have sent me a few books to read and review, and I will be posting them to my blog for everyone to read. I have picked books from them that I believe are topics worth exploring and actually reading from a book (and not just finding a resource online).

The first book that was delivered is the one that this post is dedicated to. Object-Oriented Programming with PHP5 by Hasin Hayder was picked to go over what I believe to be the base of successfully programming in PHP. Object oriented programming is not an option anymore when working in this business. So if you have been stuck as a procedural programming in PHP it’s time to remedy that and apply some new (well not really new) techniques and master the language.

Hayder begins the book off with exactly that, discussing and demonstrating the differences between Procedural PHP and Object Oriented PHP. I believe this knowledge to be essential to start your OO voyage. Pay attention to examples in this chapter as they give some good feedback on what cases OO is necessary. Hayder also explains the differences between PHP4 and PHP5’s OO approach for anyone who has PHP4 systems still in play. After that Chapter 2 goes into the nitty gritty basics of using OOP in PHP, including a sections on using interfaces and abstract classes.

The next chapter that sparked some interest is the chapter on Design Patterns, including some of my favorites: Singleton Pattern, Lazy Loading, and Adaptor Pattern. This is a must read if you will be developing frameworks or working with some of the more modern frameworks like Zend Framework. Here at NFi Studios we do framework development on top of Zend and commonly use some of these patterns.

Another hot topic over at work is Unit Testing, which is covered briefly in Chapter 5, I recommend reading this chapter and checking out the section on TDD (Test Driven Development), and the brief section on PHPUnit. I do however wish this section was a little bigger, but this is a book on OOP and I guess I could get a book on Unit Testing later on.

Other topics covered in this book include PDO (which is a database staple of Zend Framework), XML and MVC (which is the most popular architectural pattern in the PHP web development world). The books strong points are its definitions of OO concepts and examples given about them. So if you have a brief understanding of Object Oriented Programming but don’t understand all of the concepts, this book is for you.

For a good yet shorter read on PHP techniques using OOP I recommend this book. It gives you a good synopsis of big topics and gives you the ability to dive into bigger more complex books and some of the web resources and API’s out there.

Leave a Reply

Your email address will not be published.