in reply to What habits do you have to avoid introducing bugs?

I try to use lots of small procedures rather than a few large ones. It enables a bigger picture of the logical flow, and prevents you from getting bogged down in details.

Whenever I see duplicate occurrences of the same code, I try to use a sub instead. (If there's a problem with it, a fix to the one sub fixes all occurrences; you know the code is supposed to be identical.)

These prevent logical as opposed to physical problems...

Revised:Always test error returns! Always display error returns with associated parameter(s) (as opposed to simple text)!

  • Comment on Re: What habits do you have to avoid introducing bugs?

Replies are listed 'Best First'.
Re^2: What habits do you have to avoid introducing bugs?
by andreas1234567 (Vicar) on Feb 06, 2008 at 11:54 UTC
    [..] small procedures rather than a few large one
    This also has the added benefit that is will probably be easier to test. chromatic writes (IntroTestMore.pdf, p32 of 69):
    writing testable code
    • the smaller the unit, the better
    • the simpler the unit, the better
    Be sure to read his Perl Testing: A Developer's Notebook.
    --
    Andreas