Commitment to Zend Framework - any arguments against? [closed]
开发者_Python百科
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this questionI 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.
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', 'you@example.com', 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.
EDIT
There are some new kids worth checking out, like Laravel
The one thing ZF really wins over other frameworks is the router, controller and views, conventions, clean readable code, process.
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.
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 !
- A great example is Doctrine (the default ORM of Symfony), which can be used with ZF quite easily -- and is much better than
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...
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.
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.
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 ;)
精彩评论