A design problem I met again and again.

一首诗 newptcai at gmail.com
Wed Apr 1 16:38:43 CEST 2009


I also think that's my best choice.  Before I wrote my mail,  I
already knew that this is not a good question.   It lacks details, and
it is too big.

But I think the first step to resolve a problem is to describe it.  In
that way, I might find the answer myself

On Apr 1, 6:40 pm, "andrew cooke" <and... at acooke.org> wrote:
> Ò»Ê×Ê« wrote:
> > 3. completely move codes in service to business classes.  Initialize
> > these classes and pass them to protocol classes.
> > These protocol classes calls these instances of business classes
> > instead of call service.  These means whenever I add a new business
> > class.  I have to add a parameter to __init__ methods of every
> > protocol class.  Not very clear either.
>
> i don't fully understand your problem, but i would guess (3) is the
> correct solution.  you can probably avoid adding a new parameter by
> writing code in a generic way (using lists of arguments, perhaps using
> introspection to find method names, etc)
>
> andrew




More information about the Python-list mailing list