Book Report: A Beginner’s Guide to Zend Framework

December 20, 2010

Zend Framework

Title
Zend Framework, A Beginner’s Guide
Author
Vikram Viswani
Publisher
McGraw/Hill
ISBN
978-0071639392

 

I’m spending this holiday season trying to plow through some of the books that have been stacking up lately. There are just too many good books out there. Today’s book is by Vikram Viswani, a name regular readers will recognize instantly. Vikram has been a long-time contributor to DevZone and is the author of our most popular article series, Zend Framework, A Beginner’s Guide

For those curious, the book weighs in at 411 pages plus appendix. If you buy your computer books by weight and not by content, it’s not a great value. However, if you are looking for solid Zend Framework content in a very readable format, this is a good book. Vikram carries the writing style of his articles with him in this book. The language is easy to read, the examples are clear and there’s even a joke or two in there that will make you groan. In short, I would recommend this book to any PHP developer with a firm grasp on object oriented programming in PHP. If you are not comfortable with OOP, this is not the book for you.

The bad

Let’s start with what I didn’t like about this book and get that out of the way. This book jumps around a bit. Several times, new concepts or components are introduced without explanation only to find that they are fully explained later on in the book. I tried to look at the contents form the point of view of someone new to Zend Framework. Each time a new component was introduced, I looked back to see if it had been discussed and explained before. In most cases they were but in a few very important cases, they were not. Since the target audience of this book is a developer with past experience, I don’t think there are any situations where this becomes a show stopper, but it may cause you to stop, re-read and go Google to figure out what is going on before moving on to the next section.

Second, Vikram and I disagree on how Models should be built. He spends a good deal of the book talking about integrating Doctrine and Zend Framework and using this integration to build your models. While I have no problem with Doctrine (I have friends on that project and respect it for what it is) I don’t like coupling Models to any specific persistent data store like a RDMS.

Third, as a programmer, I see the need for configuration files and Zend Framework makes good use of them. However, in many cases, there are two ways of doing something, by code or by config file. As a programmer, I would prefer to be taught the code way and then have the config file way explained to me once I understand what is going on. in several cases, most notably when discussing routes, Vikram relies on the config file instead of showing me the way of implementing them in code. Eventually, he does show an example of a route built in code and the proper place in the Bootstrap to do it but it is well into the book and it is almost an afterthought.

The Good

I’ve already mentioned the writing style but let me reiterate it here. Vikram is a polished writer and a great programmer. It’s easy to find one or the other but when you put the two together, the experience of reading the book is so much more enjoyable. Vikram’s style and pacing make this an easy book to follow, whether you are consuming it over a weekend or a month. The content is, for the most part, logically organized and the topics that are covered are covered in great depth. Chapter 3, Working with Forms, is almost worth the price of the book alone. Zend_Form is an ugly hairy beast with lots of warts. Vikram does an excellent job of explaining not only the basic uses but showing you example code how to really make it shine.

The code examples are complete, almost to a fault. Many publishers don’t like it when an author fills a book with code examples, they consider it padding. Thankfully, McGraw/Hill does not and they allowed Vikram to put as many as he needed in there to drive home a point. The code examples are clear, obviously necessary and very easy to follow.

The book is complete. Having been working with Zend Framework since version 0.2, having taught classes on it and having written a book on it myself, I can say that I am familiar with most of its pieces. In looking at the table of contents, there are very few topics that I did not see in this book that I would consider beginner topics. It is not a complete guide to Zend Framework but it is an excellent beginner’s guide. (Which is really all it promises)

Wrapping it up

I get a lot of books sent to me for review. Most of them have enough in them that I don’t like so that I don’t review them. So when I do take the time to review one, it is because I saw merit in the book. I see merit in Vikram’s book. As I said in the opening, I would recommend this to any PHP developer who understands OOP and wants to learn Zend Framework. If you like it, make sure you drop him a note over on his website, melonfire.com and tell him so.

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

8 Responses to “Book Report: A Beginner’s Guide to Zend Framework”

  1. irishstudent Says:

    Hi all,

    As I suspected my virtual host was not fully configured correctly and as a result I was receiving 404 errors.
    I had to edit the httpd-vhosts file to get things working correctly.

  2. irishstudent Says:

    Hi I’ve found that on following the code exactly in the try this contact form I constantly received 404 errors when trying to access the page.
    I downloaded the code from the site and I’m still getting the 404 error. I’m not sure if this is due to my Windows 7 Apache setup.

  3. panupatc Says:

    I just recently got this book as my very first guide to Zend and I have mix feelings following the examples in the book.

    The language is easy to follow and the book is fun to read, a rare thing in programming book. I especially enjoyed the first 2 chapters which explained the fundamental idea of Zend.

    Starting from chapter 3 tho I think the code example starts to get annoying. Perhaps just a personal opinion but I really prefer to have just 1 working example I can type after the book and experiment with it myself. Instead of showing bits and pieces of codes showing every component of the form class over and over which cannot be used. This characteristic carries through chapter 4 and 5 (which is where I am at right now).

    Apart from the annoyance mentioned, I am enjoying this book and learning a lot on the way.

    And thank you Vikram for replying my e-mail :)

  4. vvaswani Says:

    Hello and thanks for reporting these items.

    - With regard to the first comment about the file name: this is a known error and is already noted on the book errata page (link below).

    - With regard to the second comment about the object accessor: this is not an error. If you page further through the chapter, you’ll see that the code on page 178 is refined further on page 190 and the final solution uses the object accessor. The code archive always reflects the final solution for the chapter, and not any of the intermediate steps.

    In general, while we’ve done our best to minimize print errors, it isn’t always possible to catch them all and a few minor ones have slipped through. These are all however listed on the book errata page, which can be found at http://www.zf-beginners-guide.com/errata.html so do check that out, and my apologies for any frustration you have experienced!

  5. wwwyccc Says:

    Occasionally, the code do seems to be not working, and I believe, most of the times, it’s due to inconsistency between the codes in archive and the codes in the book. There are also minor issues with file extensions and directories.

    For example, in Chapter 6 page 178 near the bottom, the view file extension should be search.phtml, not search.php. Also the file should be stored at $APP_DIR/modules/catalog /views/scripts/item/search.phtml, not $APP_DIR/modules/catalog/views/scripts/search.php.

    Further, if you check the search.phtml codes in Chapter 6 archive, the result is retrived by using

    $this->escape($r->Title);

    which will give you a ‘Notice: Trying to get property of non-object" error. But the codes in the books are

    $this->escape($r['Title']);

    which will give you the correct results. But since most of the times people just go download the codes from archive and copy and pastes, these minor issues are hard to catch, and will only be caught if you actually went through the codes.

    But after all it’s really a great book. I learned very much that is almost impossible to learn by using the reference guide.

    A revise of the discrepancies between the codes in book and the codes in the archive will be deeply appreciated, as it was very frustrating to troubleshooting these small errors.

    Thanks!!!

  6. vvaswani Says:

    Cal, many thanks for the thoughtful review and comments!

    For users who are considering the book, remember that you can always download a sample chapter as well as complete working code archives from the book site at http://www.zf-beginners-guide.com. For further information, feel free to contact me using the contact form on the same site.

  7. vvaswani Says:

    Complete code archives for the book can be found on http://www.zf-beginners-guide.com

    No problems have yet been reported about the code not working, so feel free to email me directly using the contact form on the above site and I will try to help you debug the problem you’re having. There’s also an errata and troubleshooting page on the book Web site that you might find helpful.

  8. shinokada Says:

    The main problem of this book is that code does not work.