[Seaside] Object Model in Seaside

Conrad Taylor conradwt at gmail.com
Fri Aug 24 04:38:19 UTC 2007


Hi, you can easily seperate the two.  Your view can be derived from
WAComponent and your model can easily be derived from Object or any
non-WAComponnent class.  It seems that you might be mixing the View and
Model.  For example, if you're talking about how it's presented to the user,
then we're talking about a view.  On the other hand, if you're talking the
data that gets rendered, then you're talking about the view.  Next, the name
of a class should convey its intention.  If you have a reporting
application, you can use the Report as your model and ReportComponent as the
associated view.  It's really up to you but you get the idea.  Now, a
ReportComponent may have several actions:
list
edit
update
download
and so on

Furthertmore. these actions may invoke other components (i.e. views) for
managing the underlying model (i.e. Report).  Well, this is one way of
structuring your code and I wish that it helps.

Good luck,

-Conrad

On 8/23/07, Oleg Richards <orichards at mail.ru> wrote:
>
> Hello!
>
> First of all i would like to say thank you to everybody, who helped
> me with
> evaluation expression suggestions.
>
> My next question is model - view separation. This night i have found
> one solution, but
> i would like to know your opinion, guys. So here is it:
>
> I have a reporting application. So i have model Report Template. This
> report template consists of
> different rows. Every row is defined by each own class, inherited
> from BaseRow for example.
>
> Now i need to render template. In my TemplateComponent i should go
> through each row and render it, but
> every type of row looks different. If i will add a big if - it will
> be procedure code. I dont want it and i don't want
> to write code to this if, if i need to add more rows. Another way is
> to add rendering code to row model itself. But this
> will break model - view separation. So what do you recommend to me?
>
> I found this solution: Create one more class (Should it be inherited
> from WAComponent ?) - RowComponent or RowVisual.
> And create a subclasses for it, which will represent every type of my
> row. Then i just should go through every row in my
> TemplateComponent and look up at dictionary which will find a proper
> Component renderer for me. With such way i can also
> make additional functionality. I can create subclass of
> SpecificRowComponent for different application modes - for example
> Editing, Viewing, e.t.c.
>
> So what do you think about it? Is there a better way to accomplish it?
>
> Cheers, Oleg
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070823/f238b8f4/attachment.htm


More information about the seaside mailing list