[Seaside] Lazy initialized

Michael Perscheid michaelperscheid at googlemail.com
Sun Feb 23 15:23:53 UTC 2014


Hi Dal,

lazy initializing means to create the instance first in the getter accessor. 
This looks in Smalltalk like follows:

#taskEditor
	^ taskEditor ifNil: [taskEditor := StTaskEditor new]

Best regards,
Michael

On 23.02.2014, at 14:18, Dalarna Ors <dalarna1907 at gmail.com> wrote:

> Hi,
> 
> As I'm not smalltalk king yet I have some "struggle" with some stuffs from the tutorial.
> 
> In this text author write about  lazy initialized .
> 
> "
> To connect the listed tasks to our newly created task editor we have to add an instance variable taskEditor to ourStRootComponent and create the accessors for it. In addition, it should be lazy initialized with an empty instance ofStTaskEditor. Of course, we could create a new instance for every edit request and thus get rid of the variable, but this would be an unnecessary overhead of object creation.
> "
> 
> How should I write the code ?
> 
> //Dal.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

---
Dr.-Ing. Michael Perscheid
michaelperscheid at googlemail.com

http://www.michaelperscheid.de/



More information about the seaside mailing list