Am 30.05.2018 um 05:20 schrieb Ben Coman <btc@openinworld.com>:While protoyping in a "live" system like Pharo, you often may add a new instance variable to existing object,the value of which is "nil" and may break the associated behaviour you next add.To deal with that you either have to sprinkle ifNils: around your code,or alternatively do it in one location with lazy initialization.So in general, lazy initialization is good for prototyping.Once you're past prototyping there might be some advantage to refactoring away from lazy initialization.cheers -benOn 29 May 2018 at 23:49, sergio ruiz <sergio.rrd@gmail.com> wrote:If a model has a list of things.. such as a user that can/may have lots of pets, are there any real benefits to initializing the list of pets lazily?like:self pets := OrderedCollection new.vs.petspets ifNil: [self pets: OrderedCollection new]^ petsthanks!----
peace,
sergio
photographer, journalist, visionaryPublic Key: http://bit.ly/29z9fG0
#BitMessage BM-NBaswViL21xqgg9STRJjaJaUoyiNe2 dV
http://www.codeandmusic.com
http://www.twitter.com/sergio_101
http://www.facebook.com/sergio101