Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Avoiding silly programming mistakes

by Porculus (Hermit)
on Aug 23, 2008 at 17:43 UTC ( [id://706434]=note: print w/replies, xml ) Need Help??


in reply to Avoiding silly programming mistakes

I made a lovely silly mistake yesterday. One of the kind where neither strictures, nor warnings, nor syntax highlighting can help. One of the nasty kind where the code appears to work, and produces a plausible but incorrect result. Something functionally equivalent to:

my $bitstring = get_bitstring(); # Number of records is stored in first octet my $record_count = oct $bitstring; for my $i (0 .. $record_count - 1) { process_record( get_record($bitstring, $i) ); }

It must have taken the best part of ten minutes for me to spot the two-character brainfart that was causing that never to process any records...

Seriously, I don't think there's any way to prevent "doh" moments. The best one can hope to do is to prevent those errors that can be prevented, and make sure your tests are comprehensive enough to catch the rest.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://706434]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-19 19:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found