Jason Gilmore – a PHP developer, prolific author, and friend of mine – has released a new book titled “Easy PHP Websites with Zend Framework”. He sent me over a copy (e-book style, no dead trees here) and asked me to take a look at it and write up a review. Those readers who know me, know that I’ll pass on writing a review on a book I don’t like. Having written one (and have another in the works), I know the work that goes into even a bad one. So instead of denigrating someone else’s work, I’ll simply not write the review than write something bad. I said all that to say this, the fact that you see this review means I found enough in this book that I like to review it.
Actually, there is very little to not like in this book. It is well written, the examples are clear and easy to understand, and the sample application is more than just a contrived concept to prove a point. Personally, I love technical books that help you build an application over ones that use contrived examples to illustrate a point. Jason has taken the time to develop a sample application that is beyond the simple yet still gives the reader room to experiment on their own inside of the framework.
This book however, is for Zend Framework beginners. If you have been working in Zend Framework for any length of time at all, you won’t get as much out of this book as someone approaching it for the first time. Zend Framework is notorious for having a very steep learning curve. That learning pays off when after you have mastered it but it intimidates a lot of people in the beginning. “Easy PHP Websites with Zend Framework” book helps flatten out that learning curve by walking you through the development of the sample application from start to finish. Even the introduction of the book is designed to help you by giving you a one-paragraph description of what is covered in each chapter.
In a book like this, it is difficult to pick out a “favorite chapter”. Each person will probably have a different one because each of us is at different point of the learning curve. For me, my favorite chapter in this book has to be “Chapter 5: Creating Web Forms with Zend_Form”. I chose this because I absolutely hate Zend_Form. There’s nothing wrong with the code mind you, I just hate the concept of building something that is essentially going to generate HTML every time I run it. Part of my hatred stems from the fact that Zend_Form is a complex beast that is daunting to someone not used to it. Jason goes a long way to soothing my hatred in Chapter 5. He does a good job of explaining how to use it in a simple scenario and then constantly layers on the more complex pieces, one at a time, until you are using it in complex situations without even thinking about it. Don’t get me wrong, I still hate Zend_Form, but at least now I understand it better.
No book is perfect and this one fails in the same way that many others have in the past, it treads on one of my personal pet peeves. The only thing bad I can say about the book is that Jason, like so many authors, teachs that Models (in an MVC application) should be created by subclassing a DB class of some kind. Call me old-school but Models!=Database tables. Yes, in many instances you store the data associated with your model in a database table, however, there are many situations where the persistent datastore of an application is something other than a traditional SQL database. I am willing to admit that it is a personal preference and as such I can’t say that the book is wrong for teaching this, however, it is an irritant. It should be telling though that the worst thing about this book is only that it irritates me in a small way.
One thing I did find interesting though is that Jason goes beyond just the traditional Zend_Db* classes. He has written an entire chapter on using Doctrine ORM with Zend Framework. It is still teaching you to equate models with databases but if you are going to go down that road, you might as well do it right. Doctrine is probably the most respected of all the PHP ORM’s out there and it is interesting to find an entire chapter in a Zend Framework book on how to integrate it.
Another thing that is unusual for a Zend Framework book is an entire chapter on using Capistrano to deploy your application, once complete. Capistrano is a Ruby based application and as such, Before showing you how to use it, Jason shows you how to install Ruby. It’s a bold choice to suggest a Ruby deployment application over the more traditional deployment tools like Ant or Phing. However, Jason justifies it and takes you through the necessary steps. Whether you like his choice of tools or not, you have to respect that fact that many development books stop at development, some take you through testing, but precious few show you how to actually deploy your application and it’s updates into production.
If you are thinking about getting into Zend Framework development, this is definitely a book you want to own. I don’t see it as a reference book that you will keep handy and constantly refer to. It is a guide to get you up the mountain. As such, when you buy it, you need to either put it on your bookshelf so people will be impressed when they walk into your office, or you need to set aside some time to actually read the book and work through the examples. (Note: Both are valid reasons for buying a book but only one will make you a better programmer)