Book Report: Easy PHP Websites with the Zend Framework

April 15, 2011

Uncategorized

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.

The Good

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. :)

The Bad

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.

The Interesting

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.

Conclusion

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)

About Cal Evans

Many moons ago, at the tender age of 14, Cal touched his first computer. (We're using the term "computer" loosely here, it was a TRS-80 Model 1) Since then his life has never been the same. He graduated from TRS-80s to Commodores and eventually to IBM PC's. For the past 10 years Cal has worked with PHP and MySQL on Linux OSX, and when necessary, Windows. He has built on a variety of projects ranging in size from simple web pages to multi-million dollar web applications. When not banging his head on his monitor, attempting a blood sacrifice to get a particular piece of code working, he enjoys building and managing development teams using his widely imitated but never patented management style of "management by wandering around". Cal is currently based in Nashville, TN and is gainfully unemployed as the Chief Marketing Officer of Blue Parabola, LLC. Cal is happily married to wife 1.28, the lovely and talented Kathy. Together they have 2 kids who were both bright enough not to pursue a career in IT. Cal blogs at http://blog.calevans.com and is the founder and host of Day Camp 4 Developers

View all posts by Cal Evans

6 Responses to “Book Report: Easy PHP Websites with the Zend Framework”

  1. dckurushin Says:

    Must have for beginners…
    Would make you fill like ZF is easy like code igniter…

    Zend should buy the book rights, and put it as a tutorial in their website… that would make ZF as twice as popular…

  2. fdrouillard Says:

    I wish I could retract my previous comment — it was a bad rap on a good book.

    My apologies to the author, who bent over backwards to help me get my configuration right and the source code of the companion website working properly.

  3. fdrouillard Says:

    This book needs some serious editing.

    Like so many other publications on PHP with the Zend Framework, this book glosses over too many stumbling blocks for newbies.

    Early on there are too many in-depth discussions that are over the head of newbies. A lot of code is presented, but it is unclear what is needed to make the examples work and what isn’t. Many times it is unclear where the code should go.

    Chapter 5 on forms is especially bad. The code presented in the book results in forms that don’t work. The "Testing Your Work" section at the end of the chapter is pretty useless with code that doesn’t work.

    We’ll see how the remaining chapters go. Thus far, I’m extremely disappointed. This book would have a much wider audience if the code were provided for each chapter. That would better match the author’s claim that the book shows how progress as the application develops.

    Newbies need more of a "Sing Along With Mitch" approach. Show us all the code that is needed to make the examples work and where that code should go. Once the reader has workable code, the advanced technical discussions will make much more sense.

    Sorry, but it had to be said.

  4. ysirjean Says:

    Hi,
    I’m a newb in zf,
    The book is "relatively" easy to understand and helps me to begin. Some pieces of code unfortunately doesn’t work properly. The author said in that book that he is very happy to answer to readers, but i found no answer to my mails… Hopelfully, searching the solution helps you to understand. Sorry, and it’s problematic, some code bugs have no answer.

  5. emxs Says:

    To add to the Bad:
    Doctrine is not only introduced but all the examples/sorces use Doctrine.
    ie it’s rather Zend_DB that is introduced (very well though).

    Even worse in my opinion are the ‘requirements’ to work with this book:
    Besides Doctrine2 you need to install the PHP-Google-Map-API Library and the Blueprint CSS Framework.
    And ‘Because it would be a violation of the Amazon Product Advertising API’s terms of service to make content retrieved from the Amazon.com database available to others in a
    format such as a database table dumpfile, [...]‘ you have to create an Amazon Product Advertising API account to get the necessary data to fill the database with.

    sorry, but that’s ridiculous.

    It looks like an very interesting book, what i’ve seen so far, covering quite some not so often seen features (as Cal already mentioned) but if i’m not mistaken with above said (pls correct me if that’s the case) i’m not sure whether i would recommend it as a ‘must have’.

  6. nunomazer Says:

    I must agree with you, models!=database entities.
    In my classes I constantly get myself in discussions with the students that come with a poor vision of o.o. techniques and have learned that mvc is to program with layers and the M part is relative to persistence.
    I’m working in a master degree dissertation where hope to write some article about software architecture and show the differences about design patterns and architecture patterns.

    BTW, thanks for the review, I probably buy this book to indicate it at university.

    Ademir

    http://ademir.winponta.com.br