[Tutor] Problems with references
Martin Hjort Eriksen
martin at hardcoder.dk
Wed Jun 2 03:41:59 EDT 2004
Thank you very much for your answer.
>If the dictionary is defined as a class attribute it will be
>shared across instances. That is what class attributes are for.
That depends in what language you are working.
>Off topic, but looking at this code I can't help thinking it
>doesn't look very object like... Couldn't the connectionObjects
>themselves figure out what to do? Rather than have a 'if type==XXX'
>statement? Such statements are very rarely needed in OO designs
>and are a common maintenance headache in the future. On of the
>big bendefits of OO is to avoid those types of if statements.
>But without more understanding of what the various objects do
>I can't be sure, so maybe you do need to do it that way.
You are totally right, and normally I would not work in this way. The
problem is that this is the first time I work with Python, and I am
still learning all the little quirks of the language. Later versions of
this program will be better designed.
More information about the Tutor