What makes code "readable"? (was Re: Python vs. Perl, which is better to learn?)

Peter Hansen peter at engcorp.com
Mon May 6 19:43:10 EDT 2002


Mark McEahern wrote:
> 
> [Peter Hansen]
> > More out of curiosity than an intention of starting a flame war, but
> > would someone post a snippet of twenty or so lines of Perl which they
> > believe is "readable"?
> 
> Does anyone know of research into what the criteria for readability might
> be?

That's a good slant on it!  I have no idea ... Google?

When I was looking at that "readable" Perl code which George
pointed us to (some comments probably forthcoming from me in 
a reply to his post, but in any event thanks George! :)  I 
started to ponder that question.  

"What makes code readable?"

(Actually it was "why do I still not find this highly readable?")

One thing that occurred to me was that the Perl code had a
very high number of "transitions" between punctuation and text.
Effectively every line, and sometimes literally a dozen times
within a line, text and symbols are mixed.  Not just the odd
parenthesis or period, but great streams of that infamous Perl
"line noise".

I think a high "symbol-set-transition rate" (please offer a better
term) leads to low readability.

Punctuation itself also inherently lowers readability, I believe,
which is a reason I find assembly easier to read than Perl, though
clearly less productive.

-Peter



More information about the Python-list mailing list