ASPit - Totally ASP JSit - Totally JavaScript
Search PHPit

Use this textbox to search for articles on PHPit. Seperate keywords with a space.

Advertisements

Book Review: PHP 5 Objects, Patterns and Practice

(Page 2 out of 2)

The third part of the book is all about one thing: Design Patterns. In the first chapter of this part (chapter seven) you are introduced to the concept of design patterns, what they are and why you should use them. The author also introduces the "Gang of Four" and the famous "Patterns of Enterprise Application Architecture" by Martin Fowler. Although this chapter doesn't introduce any patterns yet, it's still a very interesting and useful chapter. If you're going to use design patterns, it's important to know about the background of them, and it's all explained in this chapter. I never knew anything about them myself, so I learnt a great deal from this chapter.

Chapter eight will take you through some important pattern principles. This chapter starts of with something called "The Pattern Revelation" in which the author mentions an anecdote in which he had a revelation once he discovered design patterns. To quote from the book:

"It wasn't until I discovered Design Patterns, otherwise known as the Gang of Four book, that I realized I had missed an entire design dimension."

After reading this book, you will probably feel the same way. I certainly do!

The rest of chapter eight talks about a few key principles of design patterns, and things you should look out for, like overusing design patterns.

In chapter nine you will be introduced to the first design patterns and the author explains the following patterns: the Singleton, the Factory Method and the Abstract Factory, which are grouped under "Generating Objects". Design patterns can be hard to understand, but the author does a good job at breaking them down. Each pattern is discussed in the same format: the problem, an example implementation, and the consequences of using this pattern. This gives you a good overview of each pattern, and I'm very pleased the author did it like this.

In chapters ten and eleven you will be introduced to more patterns, including the Composite pattern, the Observer pattern, the Visitor pattern, and more. In chapter ten I had my first eye-opener event, when I read about the Decorator pattern. I immediately recognized the problem I was having in one of my own scripts, and why the decorator pattern is the right way to fix it. Without this book I would've never considered the Decorator pattern, and probably would've used a really clumsy solution.

Chapter twelve is a really interesting one, and covers a topic I often don't see. It explains how to actually present data to a visitor, using various design patterns, such as the Front Controller or a Page Controller. The author demonstrates a complete implementation of a simple script which can be used to manage theater events. I found this chapter really useful, and I bet many others do too, because it shows a good OOP implementation of handling different pages.

Chapter thirteen is the first chapter of the third part, and leaves all the design patterns and OOP, and takes a look at a complete different aspect of programming: how to do it as effective as possible. This is something you don't see covered often in a PHP book, as it's usually about the PHP itself, but in this book you will learn about other topics such as PEAR, version control (using CVS), unit testing, generating documentation with phpDocumentor and creating automated builds with the Phing project. In part three all these topics are covered in depth.

Finally, part four, which consists of only chapter eighteen, simple rehashes everything that has been said in the book, and takes a quick glance at the most important things. This is not really an important chapter, since it's all stuff that has been covered already, but it's still nice to get everything in a clear overview.

Final Verdict

If you're just starting with PHP, you shouldn't buy this book, and instead start with a simpler one.

But if you've already been using PHP for a while, I can highly recommend this book to bring you to the next dimension of programming. It will introduce all the necessary concepts, and explain everything with simple (as possible) examples. I've been struggling with OOP and design patterns myself for the past few months, and I've finally begun understanding it after reading this book. It's definitely been a revelation for me!

So, if you want to know more about OOP, design patterns or design, this book is an excellent starting point!

« Previous: Part One



3 Responses to “Book Review: PHP 5 Objects, Patterns and Practice”

  1. Matthijs Says:

    Indeed! I read slower then you but being half way through I can affirm what you say about the book. This is one of those books which explains everything well and in the process gets you excited for the topic. Excellent.

  2. PHPDeveloper.org Says:

    PHPit.net: PHP 5 Objects, Patterns and Practice

  3. Chris Mospaw Says:

    I have owned this bok for a while, and it is very good. In fact, I had to reference it this morning!

    The writing is clear and concise. The examples are appopriate and (with the understanding that they’re ncessarily simple) real world. Like the reviewer said, it’s not for beginners and assumes the reader possesses a certain level of knowledge.

    If you’ve been programming PHP for a little while and want to move “to the next level” this chould be required reading.

Leave a Reply

About the author
Dennis Pallett is the main contributor to PHPit. He owns several websites, including ASPit and Chill2Music. He is currently still studying.
Article Index
  1. Part One
  2. Part Two & Final Verdict
Bookmark Article
Download Article
PDF
Download this article as a PDF file