[Seaside] Design Pattern For Accessing Model from View/Controller?

Philippe Marschall philippe.marschall at gmail.com
Fri Aug 31 19:25:19 UTC 2007


2007/8/29, Conrad Taylor <conradwt at gmail.com>:
> Hi, is there a better way than having accessors on the view?  If so, please
> explain.

That depends on your requirements. In general accessors are fine
unless you have special requirements or believe that accessors break
encapsulation.

Cheers
Philippe

> Thanks,
>
> -Conrad
>
>
> On 8/29/07, Philippe Marschall <philippe.marschall at gmail.com > wrote:
> > 2007/8/29, Conrad Taylor < conradwt at gmail.com>:
> > > Hi Philipee, thanks for responding to my post.  For example, in
> Shaffer's
> > > tutorial, he did something similar to the following:
> > >
> > >
> > > WAComponent subclass: #PersonalInformationView
> > >
> > >
> > > model
> > >   ^model
> > >
> > > model
> > >   model := anObject
> > >
> > > WAComponent subclass: #AddressBook
> > >
> > > edit:  aPerson
> > >    |view|
> > >    view := PersonalInformationView new.
> > >    view model:  aPerson
> > >    self call: view.
> > >
> > >
> > > Thus, I take it that one needs to have accessors on the view if you're
> > > wanting to modify an instance of a model.
> >
> > Not necessarily. It doesn't really matter where the view gets the
> > model from but accessors are probably the most common way.
> >
> > > Now, each renderContentOn:
> > > represents a single view.
> >
> > Each instance of a  component class represents a single view.
> >
> > Cheers
> > Philippe
> >
> > > -Conrad
> > >
> > >
> > > On 8/29/07, Philippe Marschall <philippe.marschall at gmail.com > wrote:
> > >
> > >
> > > >
> > > > 2007/8/29, Conrad Taylor < conradwt at gmail.com>:
> > > > > Hi, I have created a subclass of WAComponent.  Also, I have a class
> that
> > > > > represents a model and is a subclass of Object.  Thus, I was
> wondering,
> > > > > what's the best way to connect the my model to my component?  BTW, I
> > > have
> > > > > read the C. David Shaffer's tutorial, "Interlude:  Cleaning up the
> > > > > PersonalInformationView" and I'm just trying to see what the best
> > > approach
> > > > > for this.  Well, thanks in advance.
> > > >
> > > > In general the view components directly reference the model, e.g. from
> > > > an instance variable.
> > > >
> > > > Cheers
> > > > Philippe
> > > >
> > > > > -Conrad
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > _______________________________________________
> > > > > Seaside mailing list
> > > > > Seaside at lists.squeakfoundation.org
> > > > >
> > > http://lists.squeakfoundation
> .org/cgi-bin/mailman/listinfo/seaside
> > > > >
> > > > >
> > > > _______________________________________________
> > > > Seaside mailing list
> > > > Seaside at lists.squeakfoundation.org
> > > >
> > > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo /seaside
> > > >
> > >
> > >
> > > ______________________________ _________________
> > > Seaside mailing list
> > > Seaside at lists.squeakfoundation.org
> > > http://lists.squeakfoundation
> .org/cgi-bin/mailman/listinfo/seaside
> > >
> > >
> > _______________________________________________
> > Seaside mailing list
> > Seaside at lists.squeakfoundation.org
> >
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
>
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>


More information about the seaside mailing list