Greetings, monks.

This is a 'meta-programming' question, I guess... Recently I've been meditating upon the cause of the errors I make while programming. It seems that most of my errors are what you might call 'silly mistakes'.

For instance, recently I decided to expand my mind and learn another programming paradigm (in addition to 'imperative', which is all I've had thus far). So I set out through perltoot, and learned much. Along the way I learned about destructors and how they must be named 'DESTROY'. So I proceeded to add a thus-named sub to my source file... which promptly failed to run. After 10 seconds reflection and a forehead smack, I had put the sub in my class's module, instead of the file which use()d that module. Then it ran. Doh!

My other silly mistakes are similar - they generally take 10 seconds to fix, but can take longer to spot, especially if sleep-deprived. What annoys me is that I waste time this way. If I was paying attention in the first place, I reason, I would be a more productive (and less stressed) coder.

Can any other monks relate to this behavior? What are your strategies for avoiding those 'doh' moments? Obviously experience helps, but are there things I could do now to reduce the number of silly mistakes I make?

I eagerly await your monastic wisdom.

P.S. Please be nice, it's my first post. :o)

-- email: perl -e 'print scalar reverse map { chr( ord($_)-1 ) } split //, "ufo/hojsfufqAofc";'

In reply to Avoiding silly programming mistakes by missingthepoint

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, 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, 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.