Even though I am merely an Adept or so, already the beauty of code is something to strive for, to me. When moved from BASIC (shudder) to C, I was stunned by the seemingly magical expression wizardry of C (hey, after BASIC...). To think that you could do entire loop's job inside while() ! It eased up a bit, the joy of game diminishing, and soon I was again wading in the bore of function/class structures.

But THEN, then I learned perl. At first I wrote it almost like C (look at E2 node tracker to see what I mean...), but as time passed I started to slowly learn a bit stranger magic. Now, as I just wrote some rather peculiar (well, to me) expression, something struck me:

Why?

Is a monk's ethos (?) to create working code, or to create beautiful code (when they do not coincide)? Is the purpose of perl to create code quick, or to give the pleasure of expression meditation to the coder?

I realize that often beautiful code IS better code, efficient- or reusability-wise. But is it always? What to do if, no matter how bad it looks, a code is tad more efficient? And isn't it a bit, um, counter-productive to spend your time thinning out a block of code when you could be creating new?

P.S. My idea of 'beautiful' is influenced by my recent learning of perl and might not match yours. Still, I can't help but to observe that typical perl code *does* make use of strange chains in one expression as opposed to C-style procedures.

 -Kaatunut


In reply to Monk ethics: Beauty vs. Power by kaatunut

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.