(on Thursday, 26 March 2009, 08:42 PM +1100):
> Today I played with xdebug, which led to this funky image:
> http://www.zlty-pes.sk/zf.png
> This call graph is from the simplest Hello World application; only
> IndexController with one indexAction() method and few lines in
> index.php.
>
> Some king of complexity was expected but this graffiti was a big
> surprise for me. On the other hand adding controllers and plugins
> don't change call graph too much, which is good.
>
> I spend nearly one hour by tracking lines...
Yes, it's complex. It's complex because there is a lot of functionality
going on under the hood to accommodate the myriad use cases to which ZF
users put Zend_Controller.
Could it be made simpler? Yes, very likely. Would it lose flexibility
in doing so? Yes, very likely.
One of the guiding principles of ZF since the beginning is to provide
flexible and extensible solutions so that ZF users can adapt the
framework to their needs -- and not the other way around. Most other
frameworks take the "convention over configuration" approach which,
while it allows for clear cut decisions, does not allow developers any
easy path to migrate existing code to use the framework. (Some go so far
as to dictate what the names of database tables and field names should
be, meaning you often even need to make DB schema changes if you wish to
use an existing DB with your application.) That said, take a look at the
call graphs and performance of other frameworks -- ZF is not alone here,
even when taking a different approach.
Yes, a lot is going on under the hood. There's the work of transforming
URL segments to normalized strings for looking up controllers and
actions (this is seen in the various Zend_Filter_Inflector calls).
There's the work of routing. There's the work of resolving the various
files. There's error handling. There's a _replaceable_ conventions-based
approach for resolving view scripts and rendering them. There are
numerous plugin systems to allow flexibility of implementation and to
encourage code re-use.
I have ideas for simplifying the call graph. But all of the ideas above
are quite important to the goals of the project.
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论