I think one of the things that he is complaining is that the process of
doing models in the Zend Framework is not well defined yet, it is not a
problem for advanced programmers that know how to architect the system in a
good way, but really trouble for new programmers.

But i think it may get better as soon new proposals like Zend_Entity get
mature enough to support this kind of separation Mathew is talking about.



::: Diego Potapczuk


On Tue, Sep 8, 2009 at 7:45 AM, Matthew Weier O'Phinney <matt...@zend.com>wrote:

> -- bizhat <flash...@gmail.com> wrote
> (on Monday, 07 September 2009, 08:00 PM -0700):
> > I have been trying to study Zend Framework. I have followed Zend Quick
> start,
> > the database part looks very complex.
> >
> >
> http://framework.zend.com/docs/quickstart/create-a-model-and-database-table
> >
> > This is how every one create their models ? To me it looks very complex
> and
> > time consuimg to create model with data mapper (3 files for a database).
> How
> > this is going to save time and increase productivity ?
>
> This is *one* approach to creating models in ZF. The reason it is used
> here is for several reasons.
>
> The most important reason is that coupling models to the database is
> problematic. Models should just be classes; how you persist them should
> be decoupled. Why?
>
>  * What if your data storage in production will be done via a web
>   service?
>
>  * How do you easily test model interactions when models are tied to the
>   database? It's a non-trivial task that involves creation of and
>   maintenance of database fixtures, and creates a lot more work than
>   simply testing object interactions.
>
>  * Where do you introduce caching when you need it? (This is trivial to
>   do when you have de-coupled persistence from the models.)
>
> > CakePHP have only 3 lines to create a model.
> >
> > http://book.cakephp.org/view/334/Create-a-Post-Model
> >
> > Why Zend need 3 large and complex files to handle database interaction ?
> 3
> > files and complex code need more processing time and slow up application
> ?
>
> I'd argue that performance is not going to be the issue here. Processing
> function calls and object creation is much faster than the actual I/O
> used to interact with the database. The benefits you get, as outlined
> above, will outweigh the extra code in most situations.
>
> --
> Matthew Weier O'Phinney
> Project Lead            | matt...@zend.com
> Zend Framework          | http://framework.zend.com/
>

Reply via email to