Why Zend Framework?

Posted December 7th, 2009 by Juozas

Zend Framework As you might have noticed I mostly write about Zend Framework and related content. This has a lot of underlying reasons, so I decided to wrap up my thoughts about it and why to (not)use Zend Framework for your own projects. This is not a comparison of frameworks though, because I don’t feel like having enough experiences with other frameworks to make a fare comparison, that’s why this is going to be only a Zend Framework analysis.

History

First time I have actually built an application with Zend Framework was about a half year ago, if I remember correctly version 1.8 was already around. Although my first applications were more than two years ago, but hey were more than tests and playing with at that time new features. So as I said above, not that long ago I switched most of my company’s code to use Zend Framework, contributed some code and have also started working as Zend Framework consultant (drop me an email if interested), so I think I have a pretty decent experience to judge it.

Before diving in to the analysis, I would like to clarify, that the reasons why I’m not using other frameworks are mainly caused by the fact that I didn’t had a chance to do that. Since I’m usually working with projects lasting more than 3 months, I need to be confident enough to know that after 2 months I don’t need to throw everything away and start from scratch. Also to test a framework for me is not to create a Hello World application, I need to build something serious to know what features are missing and what problems can be a big issue. Nevertheless, I’m planning to do some research sometime.

Advantages

For me the most important piece of software: how customizable it is. As you might have noticed from the posts like this, I usually work with complex web application and would like to have ability to built it from ground up. Zend Framework was perfect for this, because everything is just a collection of building blocks, literally (or loosely coupled in proper terms). I really liked that there is no default or even worse required structure and everything can be configured very easily.

Because I’m also in a position responsible for a whole project, quality for me is very important. I don’t know how other frameworks handle this, but Zend is pretty serious with what’s in framework and how the code is maintained. Starting from requirement to sign Contributor License agreement (known as CLA) and requirement of 80% unit-tests coverage, ending with bug hunt days. Somehow it helps me to have a confidence to rely on the framework, and backwards compatibility has never been an issue (it’s surprisingly good).

Zend Framework componentsVariety of components and libraries makes development faster because I do not need to search for another library (there is also coding standards problem and a lot of smaller libraries are just a bunch of files, without any clear structure). As of today, I probably have used more than 90% of available components and because they tend to share the same configuration style or just work style, it didn’t took long to start using them. For example, just last night I converted whole application to use custom routes (one custom route per action) in about 4 hours, without having done it before at all.

Community is number one best thing of Zend Framework. Apart from contributors, there are thousands of people willing to help and share their knowledge. Usually I hangout in twitter (here), but there are also IRC channels, mailing lists, forums and many more. I’m subscribed to hundreds of PHP blogs and from what I can see, Zend Framework articles are most common and usually in a very good quality. For me web applications development is not just writing code, so having a wonderful community really helps.

Disadvantages

Zend Framework dispatchHard to learn. This is not a problem (any more) for me, but can be tricky when working with others, especially with things like form decorators. Even though Zend Framework has a very good documentation, I would say, that used techniques are sometimes not straightforward for starters and can lead to a very bad code. As with example with form decorators, once you get them, work with forms will be a joy, however at first they seem as pointless complication. I guess the best thing is just read the manual properly (RTFM in more rude words) – you will benefit later.

For some an issue can be that Zend Framework has no scaffolding. In short, scaffolding is a user interface and logic generation based on database description and business logic definitions. If you have used frameworks like Django (my favorite for Python, has perfect scaffolding), you will miss these things and it can be a first “brick wall” for your learning. Zend Framework has Zend_Tool component which provides basic project generation (you can customize it easily), but this is pretty much everything.

Connected to the both issues outlined above, Zend Framework in general is sometimes too much loosely coupled. Because all the components are just separate classes and out of the box you don’t get any sort of web application, one might have problems trying to understand what to do with all this stuff at all. It’s a great feature for me, but for someone not having any experience with Zend Framework it is probably impossible to build application without a help of blogs, books or (my recommendation) manual.

As you might have guessed, the fact that Zend Framework has lots of components also means that there should be enough developers to support them. However, this is not always the case and some components are really lacking new features or updates. For example Zend_Pdf is quite out-dated and not moving as fast as a lot of us would like to. But hey, it’s an open-source framework, so if you have ideas of how to improve things – you are free to do, believe me, it’s a great fun to contribute to such a influential software application. Nevertheless, always evaluate available components and choose what’s best for your project.

There is also the funny part – misconceptions and myths. I’ve just started working on a new article about these, so expect some interesting things very soon.

Conclusion

I hope it’s clear, that most of the advantages and disadvantages are coming from the same root – depending on what experience you have and what you are looking for Zend Framework can be a good or absolutely awful choice. For me it’s a perfect tool and currently I have no plans (even though Symfony is in my todo list) to use something else, and if you look at things which are coming in version 2.0 of both Doctrine and Zend Framework (yes, they will have integration)… Simply a good solution for serious work.

Trackbacks/Pingbacks

  1. Juozas Kaziukenas’ Blog: Why Zend Framework? | Development Blog With Code Updates : Developercast.com
  2. Juozas Kaziukenas’ Blog: Why Zend Framework? | Webs Developer

Comments (9)

  1. EllisGL

    The problem with ZF I have is that I find the tutorials lacking where I think there needs to be more info. “How does it know to pull this newly created view I created with out me telling the controller to pull it? Or did I?”

    Personally I’m a Kohana 3.0 fan. =)

  2. Paulius

    ZF seems to be more like class repository than a framework. It is more rival to PEAR than to other frameworks like CI, Kohana, CakePHP, Symfony which are more like tools to create apps.

    Moreover ZF lacks performance (especially, memory usage) drastically, compared to lightweight frameworks. But, that’s the price you have to pay for what you get…

  3. Pádraic Brady

    @Paulius: other frameworks have library components also. ZF just takes it an all new level where the MVC is practically teeny compared to the rest of what it offers. It’s performance is also extremely good, and about to get a *lot* better in ZF 2.0. If you disagree, I’d love to see the benchmarks you’re basing this on.

    @EllisGL: The rapidly evolving nature of ZF has made online tutorials a problem. The books are far more reliable (at least one them is even free in an incomplete form).

  4. EllisGL

    Paulius, most frameworks allow you to include the Zend library. Kohana 2.x and 3.0 can do it with out much effort.

  5. Keith

    Any recommendations of books on ZF which are a good starting point for beginners?

  6. TIbo

    I agree that the learning curve can be high although once mastered the the flexibility is a real plus. Imho the manual describes a lot but is not too useful as reference guide. I can really advise to look at the API docs. Seeing what methods exist gives a good overview and good leads to find specific blogpost.

  7. Juozas (author)

    Ohh, I see comments about performance :) Why is that everyone starts from this, without even having benchmarks? I have starting writing a post about this “Zend Framework is not FAT”, but pretty much from my experience framework is not a bottleneck. There other things you need to know and as with all cases – you need to have experience with framework, to know where caching must be enabled and etc. Lightweight framework doesn’t mean it’s a fast framework (not always), for example this example: http://www.doctrine-project.org/blog/php-benchmarking-mythbusters. I will write more about this very soon.

    Speaking of books, this one seems to be good, although I haven’t read it myself. There a few more, but basically manual+blogs+google is a way to go I would say.

    Usually I don’t even read the manual, but just jump straight into the code – IDE’s have good support for navigation by method name, so finding out what is happening and what data needs to be passed is only a matter of a few moments. Apart from that, manual works great for me, even though I would like to have more examples – sometimes it just takes time to get how all these objects should be connected together.

  8. Nick

    Hi,

    I don’t agree with the idea that ZF is more like a component repository. Although you can decouple almost every component, they work extremely well together.

    About scaffolding, the closest thing out there is this datagrid.

    http://petala-azul.com/blog/
    examples here: http://petala-azul.com/grid

    cheers,

  9. Newbie

    I personally prefer Kohana. Its powerful, lightweight, scalable and has a promising future.

    Zend in my opinion is pretty much a collection of libraries, and given that they can be easily integrated with Kohana, I’m inclined to use Kohana as the base for a web application and use Zend components as and when required!

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">