Who is this book for?
For those who are looking to take their programming to the next level in both maintainability and elegance. No prior knowlege of Object Oriented programming required, (though it never hurts :p)
The review
Part 1: Introduction
The first part of the book explains a little bit about the origins of Object Oriented design and how PHP evolved from a strictly procedural language to being one of the most robust (and popular) Object Oriented languages in use today. He emphasizes the collaborative nature of Object Oriented programming and makes a convincing argument for its use in almost all projects.
Part 2: Objects
This chapter is perfect for those coming from a procedural background and want to start working with the Object Oriented side of PHP. Zandstra gives us a brief history of PHP and then quickly introduces us to the basics of OOP.
Zandstra then talks about some of the underutilized tools available in the PHP arsenal. I’m really glad he did this because he reveals some very useful tools that make it much easier to do some complex tasks.
Some tools include:
- Namespaces
- Autoloading
- Class and Object Functions
- The Reflecton API
He introduces some fundamental OOP concepts such as inheritance, composition, as well as some of the higher concepts such as polymorphism and encapsulation. I’m pleased he introduced these early because these are the building blocks of object oriented design.
Finally, he introduces us to the UML (unified markup language), a system of visually representing object oriented systems.
Part 3: Patterns
This is easily the hardest part of the book to wrap your brain around. At no fault of the author however, it’s simply the nature of the content that is being presented.
He follows the same format as the famous “Gang of Four” but his selection is not as comprehensive as theirs (which is a good thing). Instead, he takes some of the more common and useful patterns and organizes them into simple, digestible sections. He also breaks down the patterns by chapter based on their context which made it really easy and useful. For example, if you’re looking for patterns for databases, no problem he wrote a chapter about it!
Some of the more useful patterns he explained include
- Abstract factory pattern
- Composite pattern
- Observer pattern
- Domain Model pattern
In this chapter though, you can’t learn just by reading. You’re going to have to try out the examples and see if you can come with your own implementations.
Part 4: Practice
In the long term this is probably the most useful part of the book. Zanstra basically tells us what a good programmer should know and what tools they should use in their work flow. If you could only read one part I would recommend you read this one.
Some of the good practices he encourages are:
- Versioning
- Unit tests
- Automated building
- Libraries
- Documentation
Just knowing how to do all of these well will make you a better programmer and a stronger asset to your team
My Consensus?
This book is already a winner with its useful collection of patterns and clear explanations of concepts. The final section however, seals the deal with its fantastic overview of good professional practices.
In conclusion, PHP Objects, Patterns and Practice should be required reading for all aspiring PHP developers.