Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Dumb mistakes that are caught immediately are not a problem. The figure that I've heard is that on average 1 line in 10 of code as initially typed has a mistake of some sort. That figure isn't unique to programming - it seems to be a fairly standard cognitive failure rate in humans that shows up in everything from errors made in formulas in spreadsheets to typos while writing. And it isn't a problem if most of the time you catch the error almost immediately. (For a similar phenomena think about how often you hit backspace while you're typing.)

The problem seems to be innate. To the best of my knowledge, you can't really reduce the rate of initial errors. Therefore you need to focus on how you catch errors. People have offered a number of suggestions. There are tools. People have mentioned strict.pm and syntax highlighting. There are programming strategies to give you additional cognitive cues. Things like making boolean variables be given names that are yes/no questions which the value is an answer to. The book Code Complete 2 has a lot of very valuable advice on that. There are practices like having good unit tests. And then there is the simple experience of having seen and caught certain mistakes so often that you're just on the lookout for them.

Now there is a funny phenomena. Which is that once you adopt strategies to correct these errors, the frequency with which you make them tends to go up! Why? Well it is because there is a lot that you have to think about during programming. As you get better, you devote less brain power to catching your trivial errors before they are made, and more to keeping track of the "big picture". This is actually a good thing. You see by adopting practices that immediately capture the trivial errors you make them utterly harmless. And the extra attention on the big picture results in better designs, better approaches, better code, and fewer of the really serious errors that could cost you a lot in the long run.

And one of the big picture items to keep track of is your sleep. It is sad, but one of the first things that goes when our mental functioning is impaired is our ability to judge how impaired we are. Which means that when you impair yourself, for instance by sleeping too little, you have no real monitor of how badly impaired you are. And the effects of lack of sleep are pretty serious, particularly for programmers. If you're noticing it, you need more sleep, then trust me, you would benefit a lot from having it.


In reply to Re: Avoiding silly programming mistakes by tilly
in thread Avoiding silly programming mistakes by missingthepoint

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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (11)
    As of 2014-09-17 14:38 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (84 votes), past polls