Paul Graham once made the point that just having each line be simple isn't everything. There is no doubt that any given line of BASIC is much simplier than almost any given line of LISP. However, on the average, the BASIC program will be much, much longer to solve the same problem. He argues that the complexity of a program is:

effort per line * number of lines

So if we assume that the LISP program has an average line complexity of 10, and the BASIC program is at 1, then it seems to be that BASIC is a simplier language. But if the BASIC program is 100 time longer, than it's really a win for LISP.

He made a rather complelling argument that a paper on some advanced mathmatical topic may be so full of specific mathmatical language that it often takes the uninitiated hours to read a single paragraph. However, without that notation, the paper would be a hundred times longer than it is.

On another point, I tend to write my code so that portions that are likely to change are easy to change. For example, lets assume that you have an AoA that needs to go into an HTML::Template loop. Here is my idiomatic solution:

$tmpl->param( loop => [ map {{ foo => $_->[0], bar => $_->[1], baz => $_->[2], }} @AoA ] );

The part likely to change here is the parameters being sent into the loop. As such, it's easy to change those. But look at the rest of the statement. To fully understand it, you have to realize that the first curly brace creates a block for the map statement, and the second curly creates a hashref. Plus, you need to know how to handle references in general, a concept that many new Perl programmers struggle with for a while (though IMHO, it's a critical step in learning Perl).

Really, it all comes down to how much Perl you know. It is only unreadable if you don't know the construct used.

"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.


In reply to Re: Legible or Obfuscated? by hardburn
in thread Legible or Obfuscated? by Velaki

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.