Magma with style

Chris Muller asqueaker at gmail.com
Thu Dec 9 19:35:02 UTC 2010


I'm not sure I fully understand the context, but a third option might
be to use ForwardingProxies.  Especially if the shared objects can be
updated by only one session (like a batch updater, for example).  Then
every other (user client) session will share the same instances in
memory.

HTH,
  Chris

On Wed, Dec 8, 2010 at 1:13 PM, Facundo Vozzi <facundov79 at gmail.com> wrote:
> Hi all,
> I'm refactoring my code and I found that I have two ways to do the same in
> distint parts of my system.
> 1) Entity class >> atCode: aCode
> "Answer the receiver instance with code equal to aCode or evaluate aBlock if
> it doesn't exists."
>        ^(self all detect: [:one | one code = aCode]) copy
> or
> 2) Entity class>> atCode: aCode inSession: anUserSession
> "Answer the receiver instance with code equal to aCode or evaluate aBlock if
> it doesn't exists."
>
>        ^(self allInSession: anUserSession) detect: [:one | one code = aCode]
> The difference is that 1 is using the shared session so I need copy the
> object to be used (referenced by other object) on anUserSession. The uggly
> of 2 is that I have to pass anUserSession as argument.
> Either way works well, is really the same?
> Thanks in advance,
> Facu
> (*) I eliminate aBlock for absent elements for this example
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma
>
>


More information about the Magma mailing list