In reading the comments already posted, I think we need a new word other than beauty. Half of these posts stumbled off-topic a bit to coding-style rather algorithm beauty. Personally I find merlyn's coding style a bit ugly but the algorithm is purty. =)

I like what princepawn is doing with his logic stuff and the constants stuff especially. But I find it even uglier.

mirod's rant saved me from writing the same thing =)

My dad once said, "There is all kinds of good looking, but there is only one kind of ugly." Now he was talking about dogs or cars or something but it is kind of true here. I see lots of great ways to express the same task, clearly and in a mostly self-documenting way. And a lot of them just moved the ugly out of sight. =) But for all those cases, the algorithm is generally non-ugly. Most of what I see is just different ways to decorate the dog.

Oddly, I was just working on a Cache module for a nasty little web problem I have. I have a hidden webserver that only my public webserver can speak to, generating graphs on that second machine. In an effort to not beat the hidden server to death (it has to do real work too) I want to cache the images locally. Rather than run a cache on the hidden machine (eek, memory) or a reverse cache on the public machine (eek only helps with the http and not the other protocols I have to get working next) I did a the next best thing. I threw Perl at it. =)

What I got was this:

use DiskCache; my $xdc = new DiskCache "image", 300; if ( $xdc->exists( "filename.ext" ) ) { print $xdc->get( "filename.ext" ); } else { $xdc->del( "filename.ext" ); my $newdata = GetDataFromSomeWhere(); print $newdata; $xdc->put( "filename.ext", $newdata ); }

Now that I've seen merlyn's stuff I suppose I'll have to do it right... =)

--
$you = new YOU;
honk() if $you->love(perl)


In reply to RE: Just thinking ... by extremely
in thread Just thinking ... by toadi

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.