Thoughts from a newbie

Peter Hansen peter at engcorp.com
Sun Dec 15 14:27:47 EST 2002


John Roth wrote:
> "Steve" <stevesusenet at yahoo.com> wrote:
> > There are two coding habits that I see often that makes code harder to
> > understand:
> >
> > 1. excessive nesting
> 
> The easiest way to avoid excessive nesting is the XP practice of
> writing your test cases before writing your code. Excessive nesting
> is one of several features that makes code hard to test.
> 
> > 2. lines longer than 80 chars
> 
> I don't see any practical way of doing this, short of going back
> to punched cards (ducks and head swiftly for the exit...)

Even the second case is handled well by another XP practice --
that of refactoring by other programmers as soon as they get 
their hands on your longer-than-80-chars-per-line code.  A
coding standard doesn't need to be strictly enforced to work well
if you do it this way (as John certainly knows).

We've got someone right now who likes long lines excessively.
Rather than go all police state on her, we just mention it casually
from time to time as we adjust the code...  with the unit tests,
this is of course completely safe.

-Peter



More information about the Python-list mailing list