[Seaside] session variable vs. dynamic variable

Ramon Leon ramon.leon at allresnet.com
Fri Feb 8 15:37:05 UTC 2008


> I am using a session variable for my sub-component callbacks 
> to gain access to a root component (to trigger an ajax 
> redraw). As Lukas had cautioned, this couples my components 
> to a session subclass and makes it harder to reuse my components.
> 
> Two questions:
> 
> 1. If WASession had an extensible dictionary of variables 
> would it help? 
> What is the downside of doing that?
> 
> 2. If I decide to use a WADynamicVariable instead, when 
> should I bind it? 
> Within my root #renderContentOn? And will subcomponent 
> callbacks see that binding?
> 
> WADynamicVariable subclass: CurrentRoot ...
> 
> MyRoot>>renderContentOn: html
>     CurrentRoot use: self during: [
>         render self and children
>     ]
> 
> SomeSubComponent>>callback
>     CurrentRoot value ...
> 
> Thanks - Sophie

Use announcements instead, break the coupling.

http://onsmalltalk.com/programming/smalltalk/maintaining-loose-coupling-in-s
easide-components/

Ramon Leon
http://onsmalltalk.com



More information about the seaside mailing list