Chris Tankersley

Zend Framework and Why It Matters

Posted on 2008-05-13

One of the aspects that I believe that has kept PHP from gaining significant ground as a legitimate enterprise language is that it hasn't had the tools to prove that it is beyond merely a hobbyist's tool or just merely a language that is good for building prototypes of an application. I don't think anyone will say that PHP slows down the development process, but a lot of people outside the PHP community (and inside) would say that PHP can make for very sloppy, insecure code.

They would be correct. One can say that about any language but PHP enables just about anyone to sit down and build an application without them really needing to know what they are doing. PHP gives the coder a large amount of power without babysitting them. This strength has also caused a lot of problems as it has let coders get away with a lot of things that have lead to large security holes.

One thing that can help mitigate a lot of bad coding mistakes is to use a good set of tools to help the coder make the correct decisions. While nothing can replace good training in both PHP syntax and coding in general, one of the strongest tools a coder can give themselves is a framework that has taken care of many of the common tasks associated with application building. The Zend Framework, while being a somewhat new kid on the block in terms of frameworks, gives a coder a large amount of usable code to speed up development while making sure that good design decisions are enforced.

Before I get too far, I should explain what the Zend Framework is. The Zend Framework an at-will application framework for building applications. This means that a coder has the ability to pick and choose which parts of the framework that they want to use and how they want to use them, unlike full-stack frameworks Ruby on Rails or symfony which tend to confine the coder into a specified way of setting up and building an application.

Do What You Want

There are people on both sides of the camp as to what kind of framework one should use, but the beauty of an at-will framework is that a programmer can use only what they need. Don't want to build a database abstraction layer? Just pull in Zend/Db.php . Want an easy way to manipulate RSS? Include Zend/Feed.php . Accessing Google's APIs? Take a look at Zend_Gdata.

The best part is the programmer is not constrained to just what the Zend Framework supplies. You are more than welcome to use your own DB objects, RSS manglers, or custom hooks into whatever. If you need something, why reinvent the wheel when Zend has taken the time to put such useful code into an easy to use system?

The Zend Framework can even extend full-stack frameworks that allow outside objects. The symfony project doesn't contain code for every programming problem out there, so they built in a mechanism for bringing in outside code. If you need to manipulate PDFs, you can bring in the Zend_PDF code into your symfony application and still save yourself time compared to attempting to build a PDF system inside symfony.

** Look Ma, I Can Do Full-Stack Too!**

Yes, I said that the Zend Framework is considered an at-will framework, and it is. The Zend Framework is such a well designed and powerful framework that it also pulls double duty as a full-stack MVC (model-view-controller) framework. While it will not set up the folder layout for you like some full-stack frameworks, Zend does have a suggested folder layout that follows the standard MVC rules.

Throw in an extremely short and generic boot strap file and you have yourself the skeleton for an MVC application that is ready to take on building a brand new application from scratch. All of the Zend Framework components fit together and play nicely to build just about any sort of application that you need.

** It Takes a Village**

All of the advantages of the Zend Framework are naught if no one can figure out how to use it. The guys working on the framework take great care in their documentation, not only at the code level to generate API documentation via PHPDocumentor but to also write and keep an up-to-date usage manual online with code examples online at the Zend Framework website.

In addition to documentation, there is a lively community available on the Zend Framework mailing lists. There is a great signal-to-noise ratio on the list. Contributers to the framework are always willing to lend a helping hand and take suggestions on the direction that the framework is heading. Even the trolls are taken care of in short order and such threads are short and quickly ended in a professional manner.

You can also get updates on what is going on via Twitter and Zend's DevZone. Many of the contributers are constantly writing great tutorials to better explain some of the more esoteric sections of the framework (Form Decorators, I'm looking in your direction).

** Why, as a Programmer, Should I Care?**

The Zend Framework is flexible enough to do just about anything that you want it to do. Just need a piece? Great. Want to build a web app from scratch? Go ahead. Need help? There is plenty available. The Zend Framework is one that doesn't care if you are updating an application, converting it to something like MVC, or starting from scratch, it just worries about helping the programmer get results.


Comments