2008年12月18日星期四

Re: [fw-mvc] Plugin vs. Static class - Init MVC

Thank you Matthew :)

Nikolaos

On Wed, Dec 17, 2008 at 23:19, Matthew Weier O'Phinney <matthew@zend.com> wrote:
-- Nikolaos Dimopoulos <nikos@niden.net> wrote
(on Wednesday, 17 December 2008, 11:00 AM -0500):
> I have an application that I have been working on for quite a bit now. The way
> I structured it was to create a bootstrap file which contained a class with
> static properties and attributes. Those are for instance the registry,
> configuration file, the front controller etc. The run() function of the static
> class runs the application by initializing the environment, setting up the
> registry, logger, db etc.
>
> I decided to use the Zend Studio for Eclipse wizard to create a new ZF
> application. Interestingly enough the structure of the project created was
> identical to the one I have already created but the bootstrap process is
> different. In that skeleton structure the bootstrap file creates the front
> controller, registers a plugin (Initializer extending
> Zend_Controller_Plugin_Abstract) and starts the application. The plugin in turn
> is the one responsible for all the init work (database, routes, views etc.).
>
> My question is whether one method is better than another. Why should I use a
> plugin instead of a static class?
>
> Comments/pointers/thoughts are more than welcome.

Statics are harder to test against and usually show that you are trying
to group unrelated tasks.

That said... you may be interested in the Zend_Application proposal,
which will be our recommended way to bootstrap your applications. You
can find it on the wiki:

   http://framework.zend.com/wiki/display/ZFPROP/Zend_Application+-+Ben+Scholzen

--
Matthew Weier O'Phinney
Software Architect       | matthew@zend.com
Zend Framework           | http://framework.zend.com/



--
The contents of this message may contain confidential or privileged information and is intended solely for the recipient(s). Use or distribution to and by any other party is not authorized. If you are not the intended recipient, copying, distribution or use of the contents of this information is prohibited.

没有评论: