Code as if someone’s life depended on it.

Message for the day…

A useful technique I use to reduce the number of bugs in my buggy programs is to code as if someone’s life depended on them. When “it doesn’t matter,” it’s easy to avoid adding all the error checking.

But once you start looking at code as if it was mission critical, you start to see things differently and begin adding “useless” error checking. As long as you can afford the extra few moments to add the “useless” error checking, and as long as you have code space to hold the “useless” error checking, and as long as you have enough CPU cycles to run the “useless” error checking, you end up with a program that should be better,

Share and enjoy.

2 thoughts on “Code as if someone’s life depended on it.

  1. MiaM

    I totally agree… Except don’t stop the program execution if the error happens in a non-critical part. Thinking about Ariane 5… :)

    Reply
    1. Allen Huffman

      I just got around to reading up on that via the Wikipedia entry. Converting a 64-bit floating point into a 16 bit integer. I guess the ADA compiler didn’t have the warnings about “potential loss of precision” or warnings were shut off or ignored, if so. :) Yipes!

      Reply

Leave a Reply to MiaMCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.