software design question

John Roth newsgroups at jhrothjr.com
Sat Feb 7 22:24:25 EST 2004


"Uwe Mayer" <merkosh at hadiko.de> wrote in message
news:c03rii$c2t$1 at news.rz.uni-karlsruhe.de...
>
> One problem I'm still having with this is: for component B to register a
> callback at component A, B still got to have a reference to component A in
> order to make a call like "A.registerCallback(...)"
> You might not know what B needs to access, so you cannot pass "what is
> needed" in the constructor, nor let the code that instanciates B set
> attributes.

I suspect you've got the callback logic backwards. The basic
layering pattern is "call down, notify up," and it's the upper layer's
responsibility to request the notification.

To explicate: the GUI module calls the domain
module for service. It also calls the domain module
to register callbacks, passing the function that it
want's called.

When the domain layer has something it wants to
tell the GUI layer, it simply runs a (possibly empty)
list of callback functions.

John Roth

>
> Ciao
> Uwe





More information about the Python-list mailing list