views:

436

answers:

6

I am refurbishing a big CMS that I have been working on for quite a number of years now. The product itself is great, but some components, the Database and translation classes for example, need urgent replacing - partly self-made as far back as 2002, grown into a bit of a chaos over time, and might have trouble surviving a security audit.

So, I've been looking closely at a number of frameworks (or, more exactly, component Libraries, as I do not intend to change the basic structure of the CMS) and ended up with liking Zend Framework the best. They offer a solid MVC model but don't force you into it, and they offer a lot of professional components that have obviously received a lot of attention (Did you know there are multiple plurals in Russian, and you can't translate them using a simple ($number == 0) or ($number > 1) switch? I didn't, but Zend_Translate can handle it. Just to illustrate the level of thorougness the library seems to have been built with.)

I am now literally at the point of no return, starting to replace key components of the system by the Zend-made ones. I'm not really having second thoughts - and I am surely not looking to incite a flame war - but before going onward, I would like to step back for a moment and look whether there is anything speaking against tying a big system closely to Zend Framework.

What I like about Zend:

  • As far as I can see, very high quality code
  • Extremely well documented, at least regarding introductions to how things work (Haven't had to use detailed API documentation yet)
  • Backed by a company that has an interest in seeing the framework prosper
  • Well received in the community, has a considerable user base
  • Employs coding standards I like
  • Comes with a full set of unit tests
  • Feels to me like the right choice to make - or at least, one of the right choices - in terms of modern, professional PHP development.

I have been thinking about encapsulating and abstracting ZF's functionality into own classes to be able to switch frameworks more easily, but have come to the conclusion that this would not be a good idea because:

  • it would be an unnecessary level of abstraction
  • it could cost performance
  • the big advantage of using a framework - the existence of a developer base that is familiar with its components - would partly be cancelled out

therefore, the commitment to ZF would be a deep one. Thus my question:

Is there anything substantial speaking against committing to the Zend Framework?

Do you have insider knowledge of plans of Zend Inc.'s to go evil in 2011, and make it a closed source library? Is Zend Inc. run by vampires run by evil vampires that want to take over the earth? (It was established in the comments that Zend is actually run by vampires.) Are there conceptual flaws in the code base you start to notice when you've transitioned all your projects to it? Is the appearance of quality code an illusion? Does the code look good, but run terribly slow on anything below my quad-core workstation?

Accepting answer

Thanks a lot everyone for your detailed feedback. I wish I could set up a bounty and distribute it evenly among all answerers.

Among many opinions favourable towards ZF, there was one very well founded one against. I took that very seriously and had a close look at alternatives, mainly Yii and Kohana. From that comparison and from reading some more opinions regarding ZF and competing products, I can see that Zend can be viewed as bloated in some fields compared to more minimalistic frameworks. (I can also see that this "bloat" is mostly with good reason to provide maximum flexibility. But the question whether you want maximum flexibility and deal with the ensuing complexity, or a simpler approach with clear guidelines, is a valid one.)

Anyway, I will go for Zend for the project at hand, because the main use I have for the framework there is as a component library. I do not want to adopt Zend's MVC model, I just need high-quality components for Internationalization, Session handling and so on. Because I am building a redistributable product, Zend's flexibility (e.g. the support for five different dictionary formats) is welcome to me. Also, ZF seems to be the only framework that allows the degree of freedom I want (No forced use of patters, file structures...) as far as I can see, no other framework offers that.

For future projects in which I want to make use of the actual MVC features, and totally submit to a framework's conventions on application building, naming, style, and procedures, though, I may not necessarily be going for Zend, but for a more minimalistic framework like Yii or Kohana.

+3  A: 

I don't have any big argument against ZF -- on the contrary ; of course, I have not used all the components yet (not sure anybody has), but I've never seen anything that looked "bad" when going through the sources.

When beginning a new project, I would generally go with Zend Framework myself, actually, if I'm the one who has to choose...


There's at least one argument I would like to add to your list :

  • Zend Framework can integrate with other components : you talked of using components of ZF in your application, but didn't talk about the opposite.
    • A great example is Doctrine (the default ORM of Symfony), which can be used with ZF quite easily -- and is much better than Zend_Db, in my opinion !

Besides that, I have to say that I agree with everyone of your points.


About the encapsulating ZF classes into your own classes : yes, you could do that (I sometimes do), but I wouldn't recommend doing it for everything : in most cases, it will probably not be necessary.


About the future :

  • Zend Framework is released under a BSD licence -- which means what exists cannot be closed-sourced.
  • Closing it would mean its end, anyway -- would be a stupid move, in the context of the PHP community
  • Work on ZF 2.0 is just starting (With PHP 5.3 as a requirement, btw)
    • Maybe, depending on your schedule for your application, it could be interesting ?
    • At least if you don't need to start developping before at least a couple of month...
Pascal MARTIN
Cheers @Pascal, especially for the information about future releases. I need to start quickly and will need to support < 5.3 for the foreseeable future, so I'll have to stick with 1.x for now. Will +1 after midnight GMT, out of votes :)
Pekka
You're welcome :-) ;; about ZF 2.0, you can take a look at http://framework.zend.com/wiki/display/ZFDEV2/Zend+Framework+2.0+Roadmap ; and you can subscribe to the contributors@ mailling-list (see http://framework.zend.com/wiki/display/ZFDEV/Contributing+to+Zend+Framework#ContributingtoZendFramework-mailinglists ) ;;; OK for quick start and PHP 5.2, though ;;; no worries about upvotes : I've already hit the rep-cap for today ^^
Pascal MARTIN
+6  A: 

Zend Framework is the best choice. Best framework API of them all, readable code, language conventions, good docs, comunity, support et all
My dislikes of it (subjective, mabe people are going to downvote me for it) are:

  • Zend_Form, has it's use, but in general is too obtrusive, I just want to structure my HTML not fight APIs and decorators.
  • Zend_Db_Table, powerful, but it needs a lot of work to accomplish your goals, and Rails taught me to be lazy. No, I don't want to write 3 classes for a model, one for the table, one for the rowset, one for the row, then bind them to each other and so on. I might need the table data gateway at some point, but for now I really want to interface this data with a quick active record.
  • no active record. With the late static binding in php 5.3 this might change ...

I tried really hard to use these two for a couple of months until I finally had it.

I overcame them by (ideas from Ruby on Rails)

  • use plain view helpers instead of Zend_Form as in:
    echo $this->formText('email', '[email protected]', array('size' => 32));
  • having my own Active Record like models ( http://www.phpactiverecord.org )
  • validate and filter on the model
  • for the really extreme corner cases, one can fall back to Zend_Form + Zend_Db_Table, although I never felt the need.

A second-best would be Cake PHP.

The one thing ZF really wins over other frameworks is the router, controller and views.

clyfe
Cheers for your input clyfe. I share your sentiment about both components incidentally. The fact that you don't *have* to use them all and conform to an overlying structure is what I like most about ZF. Will +1 when I have votes again.
Pekka
If there's one component I'd defend to the death it is Zend_Form! Filtering, population, validation, composite elements and decorators are monster tasks to manage yourself. While decorating is a bit tricky, there are some great tutorials out there.
David Caunt
It's the decorating that kills it! I don't want to fight apis i just want to structure my html! Look at the way rails does it, I bet you'll reconsider it.
clyfe
@David: I had to up-vote your comment. I agree. Some patterns are complex but well worth the effort in the long run. Zend_Form happens to employ one of them (Decorator).
wilmoore
+2  A: 

We've been developing with ZF for almost a year now, and I really have no major qualms with it. Had a bit of a learning curve, but once I understood it, I realized how well put together this framework really is.

Compared to other frameworks, some people might point out the lack of a Model library as being a downside. I actually prefer not being told what to use, and integrating Doctrine with ZF is frictionless. If you're developing in PHP 5.3, and want an ORM, I would highly recommend Doctrine 2 (caveat: it's still in alpha testing).

The other great thing is being able to pick and choose what you want or don't want. I'm not a huge fan of Zend_Form, but I don't have to use it if I don't want to. Also, there's a very loosely structured plugin architecture that lets you really easily hook your own libraries into the framework.

So, I'm a pretty big fan of it.

Bryan M.
+2  A: 

One thing I am missing in the Zend Framework is a proper OR mapper. Zend_DB is ok but has some shortcomings, especially when dealing with huge databases (many tables) it gets very cumbersome. But there are a couple of OR mappers out there that can be integrated (e.g. zend-framework-orm or Doctrine as mentioned by Pascal MARTIN).

But yes, Zend is excellent, very powerful and I feel it is in some ways what PHP actually should be/should have been in terms of interface and functionality.

What I especially like apart from the obvious is the support for Dojo for rich client applications and the SOAP support.

Sebastian
This is probably the most common objective criticism, that there is no ORM. You can use Doctrine with ZF, and an integration is coming (hopefully in 1.11) for Doctrine 1, while Doctrine 2 will work with ZF2.0
David Caunt
+2  A: 

Unless you're looking forward for a massive, giant project with 20+ developers, I'd - if I were you - would do anything including sacrificing an arm and/or a leg just to avoid Zend Framework.

  • The nice option you found out might look handy - to the point where you find other 1k+ setting that just looks like a waste of time and developer effort in the library. You'll soon find yourself in the middle of Customization Ocean, overwhelmed by settings, interfaces and abstract classes.
  • The documentation is not only detailed, but as a result very lengthy and complicated (similarly to the library itself). I want 3rd part classes to help me and not to get into my way.
  • The most important factor was the development speed for me, obviously. Without a bunch of colleges around you, Zend Framework should be seriously considered whether to be dropped.
  • There are too many people making wishes in the Zend issue tracker, too many people implementing code. To date, I've yet to see any serious vision behind those millions of lines.

My two cents really comes to down to one point: despite (or rather, because of?) it is backed by the PHP company, it is far too bloated for personal usage and small- and medium-sized projects.

My team is currently using Yii for a medium-sized project. It's not perfect either, but way more usable and developer-friendly compared to the big brother.

pestaa
Thank you for offering a serious, well argued opinion against. The project I'm working on is - even though currently maintained only by me - aimed at being big, and being developed by a number of people one day (Although probably never 20+). Your criticism is well taken, though, and while I tend heavily towards ZF also because of its popularity among developers (which got well confirmed here) I will take another close look whether yii doesn't serve my current goals better. (currently out of votes, will +1 later)
Pekka
Disclosure: I'm a massive fan of ZF and probably biased. Now then. Configuration: This is a fair point, configuring some components, esp. Bootstrap/Zend_Application should be easier. Bloat: ZF components are loosely coupled, and your autoloader will only include necessary code. Complexity/Documentation: There's an API doc for quick answers, and the reference guide details how things work. You can skip parts of it. As ZF offers a lot of functionality, there's a lot to write about.
David Caunt
I think that the learning curve may have been too steep for pestaa, but provided that you're comfortable with OOP and some enterprise patterns, you'll find ZF to be well designed.That said, with backwards compatibility maintained, some poor design choices from years ago are still with the framework. If you think there's a lack of serious vision, you should follow the contributor mailing list, where 2.0 is being designed as we speak, and check the 2.0 roadmap http://j.mp/c0FeW1 where the framework is being redesigned from the ground up
David Caunt
pestaa
I still don't understand what's expensive or bloated about ZF - PHP only includes files from the framework when you use the components. If you never reference Zend_Infocard, for example, that component's files are never loaded into memory, they simply occupy space on disk. If you were complaining that the MVC stack and Application components are slow, then you'd have a valid point ;)
David Caunt
@David Caunt, in this regard I'd consider each and every component to be slower compared to the speed they are supposed to offer. Zend Framework is a yet another Pear in my eyes. Sorry if I'm harsh, just want to make my comment fit here and my point be clear. :)
pestaa
@pestaa @David thanks for your input. I made a decision and added a paragraph to my question.
Pekka
+1  A: 

I used ZF on a project as sole developer. Although the learning curve was quite steep, I didn't encounter too many of the problems described above. In general I found the framework very flexible, and the loose-coupling of the components made it easy to do my own thing when the ZF way of doing it didn't suit my needs.

But having recently started using python, I'd say use python ;)

nick
Wait untill you use Ruby (with Rails) ...
clyfe