[Solar-talk] unique view or not
Matt M.
goodieboy at gmail.com
Tue Oct 24 17:10:29 PDT 2006
The problem that I have with using a singleton in this case is it's very
much like putting all of the different controllers response variables into a
global namespace. Variables can easily be reset on accident. I prefer to
have control over that kind of thing. Another problem I see is losing the
ability to use specific view classes. I realise that there are helpers...
but sometimes you may want a special class to handle a controller's view.
The view may have special methods for dealing with a model's display, etc.
Another problem is the fact that once you set your controllers view
variables, the variables are not special in respect to all other
controllers, and you can't access a clean set later.
Anyway! Just my thoughts...
I do understand the problem you are trying to solve. That has been solved
though by the new _wrap() and _wrapChild() methods. Have a look at them!
Matt
On 10/24/06, Travis Swicegood <development at domain51.com> wrote:
>
> Hi all,
>
> Rodrigo Moraes wrote:
> > Matt and I have been discussing the Forwarding controller off-list
> > during the weekend and I disagreed about instantiating a new view for
> > each controller. I've suffered from having more than one view instance
> > in past developments, so I have as very clear and prohibitive to have
> > more than one view instance.
> >
> > My idea is to used a view stored in the registry or in a static var,
> > but probably I could bot give him a satisfactory reason, or I was
> > wrong thinking that is completely wrong to have many view instances,
> > so he was not convinced. Can anybody help me with some reasons or
> > pointing a url were the view-as-a-singleton idea is well defended?
>
> Just my personal opinion here, though I'm sure I could find several
> resources to back me up. The Singleton pattern borders on an
> anti-pattern and should be avoided unless there is a clear, specific
> reason to use it. Have single objects that are different things to
> different objects is not a good design and couples objects - in most
> case unnecessarily.
>
> Just my two cents worth,
> -Travis
> _______________________________________________
> solar-talk mailing list
> solar-talk at lists.solarphp.com
> http://mail.killersoft.com/mailman/listinfo/solar-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.killersoft.com/pipermail/solar-talk/attachments/20061024/cbce14c0/attachment.htm
More information about the solar-talk
mailing list