• "embrace the idea that code can be wrong" -- Nathan Marz

    Surely this is the wrong approach, as it just gives people an excuse to be lazy.

    Code should NEVER be wrong.

    It is not difficult to write code that works correctly.

    You just need to follow two simple rules:

    1) Be crystal clear about the valid set of inputs, and throw an appropriate exception if the input is not in the valid set.

    2) If you are not sure whether the logic is correct, break your code into smaller functions/procedures until it is 100% clear that it will work correctly in all cases.

    Bugs only arise when people do not follow these simple rules.

    Simon