Python paradigms

Nick Maclaren nmm1 at cus.cam.ac.uk
Mon Apr 10 16:07:18 EDT 2000


In article <slrn8f4be7.1t0.bwinton at tor.dhs.org>,
Blake Winton <bwinton at iname.com> wrote:
>>
>>No.  Firstly, it relies on an artifact of my example (i.e. that it is
>>in an assignment, rather than a test condition or function call) and,
>>secondly, the more lines that code takes the harder it is to see the
>>function in its entirety.
>
>Now perhaps it's just because I've been forced to switch brace styles at
>work, but this comment kind of rubs me the wrong way.  Even on the linux
>console (possibly the least configurable text mode I know), you can get
>80 lines on the screen at a time.  It's my (not so) humble opinion that
>if your functions are 80 lines long, then you're probably doing
>something wrong.  Even if you have to break your single line up into
>four or five, surely it's not causing your functions to run off the end
>of the screen, or if it is, perhaps it's time to break your functions up
>a little.

It really is quite amusing to see these same old myths coming back
every few decades :-)

That particular dogma was very popular back in the late 1960s and
early 1970s, when practical programmers pointed out that it was a
virtually impossibility for a normal person to keep track of 50
trivial functions in their head, but it was quite easy to look
at 60 lines of sequential code.  That didn't get listened to
then, either!

See Les Hatton "Safer C" for some evidence of the disadvantages
of "mincing" code.

My current infliction is a accounting file format, and the the
function to check the input (you DO check your input, don't you?)
needs to perform 100 tests in series.  Yes, I am inventing
trivial functions, but it would be clearer to put more of the
tests inline.

Incidentally, the smallest number of lines that I have ever had
to program through was 6, and the maximum number on the early
IBM PCs was 20.  BBC Micros did better at 24 - one of their many
advantages.


Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QG, England.
Email:  nmm1 at cam.ac.uk
Tel.:  +44 1223 334761    Fax:  +44 1223 334679



More information about the Python-list mailing list