How would they encourage bad design? You _cannot_ extend the "Model" class
to achieve singleton functionality. The Controller has to call a
"getInstance" method for this to work.

A use case would be a model that needs to carry data across multiple calls.
I, for example, use a "NavigationModel" in a backend for a web application.
I can retrieve this NavigaitonModel in any View, or in a Filter, or in an
Action, and add navigational items to it. And then, finally, those items are
used by the master template to build a context-specific navigation (think of
it as a sidebar where you have "related tasks" like "View this item's
manufacturer" or "View this item's category" or "Jump to this item on the
live site"). But this only works if I always get the same instance of
NavigationModel. Sure, I could statically call the class, but that's not the
best approach for reasons laid out in an earlier mail.

- David


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Mike Vincent
> Sent: Friday, July 01, 2005 6:25 AM
> To: Agavi Development
> Subject: Re: [agavi-dev] Singleton Models
> 
> On 6/27/05, David Zülke <[EMAIL PROTECTED]> wrote:
> > P.S: there's not much harm in adding this functionality; I expect the
> > performance impact to be minimal, since it'
> 
> Except that it may encourage bad design. The points you made are all
> good cases for extending the model class, I dont see how they
> illustrate the benefits of the model class being a singleton? :) What
> is the use case for a singleton model?
> 
> I reverted your commit to trunk earlier as I had been working on some
> changes to it but didnt have a chance to finish them before you merged
> and I think it's still worth discussing.
> 
> -Mike
> _______________________________________________
> agavi-dev mailing list
> [email protected]
> http://labworkz.com/cgi-bin/mailman/listinfo/agavi-dev



_______________________________________________
agavi-dev mailing list
[email protected]
http://labworkz.com/cgi-bin/mailman/listinfo/agavi-dev

Reply via email to