develooper Front page | perl.perl5.porters | Postings from May 2000

Re: Thoughts on maintaining perl

From:
Tom Christiansen
Date:
May 25, 2000 14:41
Subject:
Re: Thoughts on maintaining perl
Message ID:
30269.959290885@chthon
>If you cannot understand this:
>    if ($x == 1 || $y == 2) {
>then I don't know what to say.  I just cannot fathom how that is hard to
>read.  

What you can say, in that case, is that the reader has not yet
learnt to pull out the structural elements visually.  It's something
that readers unfamiliar with programming, or perhaps more especially
C-style programming, must first learn before they can understand
what they're reading.  It's like trying to read a regex without
first seeing the parens and pipes, which are essential to a first-level
understanding.  There are people who believe that

    if either x is numerically equal to 1,
    or else y is numerically equal to 2,
    then do
	....
    done

would be more "readable", but this seems dangerously close to COBOL,
something difficult to argue in favor of.

I'll have an article coming up "pretty soon" about this on www.perl.com.
Being able to do two-level analysis of code at a glance is what
makes it more readable.  That's why parens are so important, whether
in be in normal or in so-called regular expressions.  Having to
engage brain to think about semantics of words and of precedence,
not clearly demarkated grouping, is what makes things slower to
apprehend.

--tom



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About