Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Avoiding silly programming mistakes

by Porculus (Hermit)
on Aug 23, 2008 at 17:43 UTC ( #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
Node Status?
node history
Node Type: note [id://706434]
help
Chatterbox?
[1nickt]: Corion HPs? ugh. I was impressed with Lenovo's gaming laptops; if it weren't for the red backlighting and general flashiness of the aesthetic, I might have gone with that. But all that was until I discovered that the Dell Precision line is still around.
[1nickt]: stevieb I don;t doubt that there's a difference. BestBuy has "consumer" models only on display.
[ambrus]: 1nickt: for some reason, these days they call every computer "gaming", even ones that gamers wouldn't buy. I've bought a keyboard that was labelled "gamer", despite that it has hard springs and seems to be way better for typing than for gaming;
[1nickt]: I though the gamers like that because they bash the keys so hard.
[ambrus]: and I've seen motherboards with no fast expansion ports for a video card but built-in hardware RAID advertized as "gaming".
LanX has a shaming laptop
[ambrus]: 1nickt: my impression is that the gamers like the softer springs, because fast reaction time is more important to them then feedback from keypresses to recognize typos.
[1nickt]: Ah, I see. I did read some gamer mag reviews, and yes, they lamented the fact that laptops with no discrete video card are sold as "gaming" hardware.
[1nickt]: But, they do have red keyboard backlighting! And gargoyles on the front, or words like "Maxxx" here and there. They know their demographic!
[1nickt]: True gamers don;t buy Dells, HPs, or Lenovos, I think ;-)

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (13)
As of 2017-03-27 13:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.