Question / extracting models in constructors

2013-04-10 Thread Patrick Davids
Hi together, I'm in a discussion with my collegues about extracting models in constructors of components. Best practices says: DONT, because of accidently holding references of extrated objects / out of mems / etc. But, if we want to have a component containing a form is responsable to

Re: Question / extracting models in constructors

2013-04-10 Thread Sven Meier
extracting model [objects] in constructors of components. Best practices says: DONT How about creating the address lazily? IModelAddress address = new CreateAndSetIfNull(new PropertyModelAddress(person, address)) { protected Address onCreate() { return

Re: Question / extracting models in constructors

2013-04-10 Thread Patrick Davids
Thank you. :-) Interesting concept... Unfortunately still have the question: Why is it recommended not to extract a given model (1), if it is just needed to create another empty model (2) via a servicecall in a constructor (I do not hold a reference to model (1) as member in the page or

Re: Question / extracting models in constructors

2013-04-10 Thread Sven Meier
You never know whether the given model is ready for its #getObject() to be called. For example ResourceModel needs its owning component to be attached to a page to function properly. we have to extract it anyway, just somewhere else. I'd phrase it we have to extract it anyway, just somewhat