Miscellaneous design and Python use questions

Tres Seaver tseaver at starbase.neosoft.com
Fri Feb 18 19:53:30 EST 2000


In article <slrn8armjh.9md.neelk at brick.cswv.com>,
Neel Krishnaswami <neelk at alum.mit.edu> wrote:
>Travis B. Hartwell <travis at travis.aggievilla.org> wrote:
>> 
>> 1)  When I do a typical OO-design with C++, I pay a lot of attention
>> to information hiding.  I.E., I keep all of the data members private
>> and rely on get/set functions to use them.  I feel that this is a good
>> practice.  But, with Python, we don't have the access issue.  I still
>> believe that information hiding is a good idea.  From the experienced
>> Python developers, is it practice to use such functions within your
>> classes?  Or do you just access things directly?  What are your
>> thoughts on style regarding this?
>
>Write it 3 times, and the right choice will be obvious the third time
>through.
>
>The first version, you'll write garbage but learn the contours of the
>problem domain; the second time you'll get a workable but ugly
>solution; and the third time through you will build something that
>*other people* will be happy reading and extending.
>
>Remember, if your interface is good then people won't try to break
>it. Consider: How often do C programmers break the FILE abstraction to
>look at the implementation details? Not very often at all -- and C
>programmers are notorious for breaking abstraction to do low-level
>grovelling for even marginal speedups.

Heh, the counterexample which jumps to mind is that "other P" language,
which does just such "low-level grovelling" for raw I/O performance.

Lets-whine-before-perls'ly,

Tres.
-- 
---------------------------------------------------------------
Tres Seaver           tseaver at palladion.com       713-523-6582
Palladion Software    http://www.palladion.com



More information about the Python-list mailing list