software design question

Uwe Mayer merkosh at hadiko.de
Sat Feb 7 14:58:56 EST 2004


Josiah Carlson wrote:

> I don't know what one /should/ call it, but what you have is what I
> would call a circular import.  You are attempting to have two modules
> use the internals of each other.  That is poor design.

[...kludge...] 
> In the future, better design is suggested.

Ok, the following is the case:
I got a GUI. This is the base class (automatically generated) from which i
derive a class that does the implementation. However, since that may become
rather big I devided the functionality into different modules, i.e. one for
presentation, one for file-IO, one for help-topic related stuff, etc.
So this main file imports the modules that implement the functionality.
Obviously these modules need to access things like "enable action"s, install
hooks, etc. from the "main part".
And thats why the circular dependency.

I know that circular dependencies are rather bad than helpful, but the only
way to circumvent this is to build everything into one big block - which I
find is rather worse: the source file grows much too large to maintain a
good overview.

So the question is rather: how to make a better design?

Ciao
Uwe



More information about the Python-list mailing list