Much of the clever code I've seen in my career was more complicated or obscure than necessary, not just written without an eye toward consequences.

An example may help explain what I see as clever code.

A couple of years ago, I worked on a system where a programmer built a lazy-loading system with built-in cache to make certain that we didn't load the data from disk unless we really needed it. Finding when and where data was read and written was a huge amount of effort. When I eventually talked to the original programmer, I was told that we needed to do this because we might have 10,000 data points. Unfortunately, these were 4-byte data points.

40K was nothing compared to the data we were working with. Despite that fact, several programmers over a period of about a decade had had to fight with this clever code that protected us from unnecessarily loading data.

In another place in the code, I ran across an N^3 algorithm that had worked fine for 5 elements, but didn't seem to work too well with a couple of hundred elements.

The first example was clever, the second did not consider consequences.

G. Wade

In reply to Re^5: "Cleverness" from HOP by gwadej
in thread "Cleverness" from HOP by Wiggins

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.