[Seaside] Seaside Book Chapter 15.3: Question about "A word about
renggli at gmail.com
Mon Dec 19 13:01:15 UTC 2011
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):
model := aTodoList
^ model ifNil: [ model := ToDoList default ]
Hope this makes sense?
On 19 December 2011 12:31, Helene Bilbo
<thereluctantprogrammer at fastmail.fm> wrote:
> 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,
> 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
More information about the seaside