prototyping good OOdesign in Python?

Kragen Sitaker kragen at pobox.com
Mon Jun 10 18:11:18 EDT 2002


Geoff Gerrietts <geoff at gerrietts.net> writes:
> With UML, I generally find that it has TOO MANY features. If I use
> Visio, or Rose, or even the lovely pyut announced a few months ago on
> this very list, they'll ask for information about attribute and method
> visibility, data types, etc.
> 
> Since Python doesn't care about most of this stuff, modelling it is
> only useful if you expect to port the code later. And I prefer not to
> plan for an unfortunate event. ;)

Well, maybe I'm polluted by my previous experience with other
sort-of-OO languages like C++, but I still include method visibility
and data types in my Python designs.  

Attributes are never visible (although that will probably change when
I start using 2.2, because visible attributes will cease to cost
flexibility), most methods are visible, and occasionally I'll add some
private methods, usually named with a leading underscore.

WRT data typing, I usually try to know what kind of thing is in
particular attributes of my classes.  The answer might be "a number",
"a sequence", "a sequence of numbers", "a mapping from strings to
sequences of (string, number) tuples", but I try to keep a clear idea
in mind of what it is.

Python makes it very easy to change my mind about all of these things.




More information about the Python-list mailing list