Re: python development practices?
by Peter Wang other posts by this author
Oct 31 2001 4:49AM messages near this date
Re: python development practices?
|
Re: python development practices?
On Tue, 30 Oct 2001 17:56:24 -0800, "John Roth"
<johnroth@[...].net> wrote:
> >
> > while i feel that Python makes me far more productive as a programmer
> > for all the projects on which i've worked, i'm inclined to agree that
> > the lack of data hiding coupled with lack of a standard interface
> > specification would cause problems in a team.
>
> IMHO, the data hiding issue is a red hering. If there's someone on the
> team where you absolutely need private variables to keep them honest,
> you've got lots greater problems than the choice of language. In python,
> if you don't want to export a variable or method, simply prefix it with
> an underscore. This will tell anyone who really cares that it's private,
> and if it's used outside, then the code needs to be refactored.
i don't think data hiding's purpose is to keep rogue programmers in
line. it's partly to insulate imperfect development practice (e.g.
sloppy documentation) and partly to define an interface for a class.
someone else made the point that this is the purpose of documentation,
which should be kept up to date; i agree but people will invariably
look at code, and with python, since the entire code of the class is
exposed (unless you split off a portion of it into a hidden base
class), it's doubly enticing to use stuff you're not supposed to.
also, code can be legacied and documentation will fall short. in
those cases, the python interpreter is not the code maintainer's
friend.
i've no doubt about the power of python when used with rigorous
development practices. my question, i guess, is really whether python
is efficient/effective if used without perfect development practices.
if the documentation is a little out of date. or if a certain
interface isn't fully spec'ed out. and the guy who wrote the code is
out of town for a week. are there good practices which safeguard
against these situations? (beyond perfect development process...)
oh, and the underscore thing seems a bit of a hack in that it
contradicts one of the core principles of python. decreasing
readibility of the code in order to express class properties to the
interpreter just screams "bolted on".
> Programming requires discipline. Period. If you're depending on a
> compiler
> to catch sloppy thinking, then you've got trouble.
i wouldn't expect a compiler to catch sloppy thinking; but having it
help trap a simple typo in a seldom-encountered bit of code would be
nice, without having to run fully exhaustive code tests.
-peter
--
http://mail.python.org/mailman/listinfo/python-list
Thread:
Peter Wang
Peter Hansen
Toby Dickenson
Tim Peters
Steve Holden
Steve Holden
Cliff Wells
Tim Peters
Martijn Faassen
Cliff Wells
Cliff Wells
Martijn Faassen
Martijn Faassen
Paul Rubin
Russell E. Owen
Barry A. Warsaw
Martijn Faassen
Peter Wang
Skip Montanaro
John Roth
David Bolen
Peter Wang
Peter Wang
Skip Montanaro
Chris Tavares
Darren Collins
David Bolen
Paul Rubin
Paul Rubin
Peter Wang
F Basegmez
Richard Jones
Richard Jones
Neal Norwitz
Graham Ashton
Peter Wang
Russell E. Owen
Skip Montanaro
Cliff Wells
Hung Jung Lu
Wade Leftwich
Peter Wang
Peter Wang
Peter Wang
Chris Gonnerman
Paul Rubin
Andrew Dalke
Paul Rubin
Luigi Ballabio
Paul Rubin
Tim Peters
John Roth
Paul Rubin
Richard Jones
|