[Seaside] Seaside Book Chapter 15.3: Question about "A word about design"..

Lukas Renggli renggli at gmail.com
Mon Dec 19 13:01:15 UTC 2011

Hi Helene,

Right, an instance variable holding the model is definitely needed.
Like this you can change the model to whatever model instance you

For example, if you want to let your user manage multiple todo-lists
or if you support multiple users with different todo-lists you can
instantiate the component with the right model. In both of these
use-cases you would need additional components that handle the login
or todo-list selection. And these components would then set the right
model of ToDoListView.

To make ToDoListView also work if it is used as the root component (as
in the book) you might want to use lazy initialization of the model
while also allowing the advance use-case (for later):

  ToDoListView>>model: aTodoList
      model := aTodoList

      ^ model ifNil: [ model := ToDoList default ]

Hope this makes sense?


On 19 December 2011 12:31, Helene Bilbo
<thereluctantprogrammer at fastmail.fm> wrote:
> Hi,
> in the Seaside Book at the beginning of chapter 15.3 there is a "note about
> design" that says that the shown design (directly accessing the singleton of
> the model in the view) is just for producing a running application quickly
> but is not good design.
> Could someone describe for a programming amateur like me what the "good
> design" would look like? It says to add an instance variable - but I am not
> so sure about how the instance variable should be initialised to the model..
> thank you for an explanation,
> helene.
> --
> View this message in context: http://forum.world.st/Seaside-Book-Chapter-15-3-Question-about-A-word-about-design-tp4213738p4213738.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

Lukas Renggli

More information about the seaside mailing list