There are numerous principles or axioms in the world that can aid you greatly if kept in mind.
Today I'd like to focus on Murphy's Law: Everything that can go wrong, will go wrong.
Think of all the assumptions we typically make about our systems:
- "The user will never do X with our product"
- "If that compiler warning was serious, the compiler would throw an error!"
- "The caller will know not to mess with that memory directly"
- "This API will never be called with a NULL pointer"
- "It doesn't matter if this behavior is undefined, the code works on this platform"
When you eliminate problems or justify design decisions by hand-waving, you are invariably creating future work to find and fix these problems. Take every assumption you have and guard against it.
Many bugs and schedule slips arise from our desire to assume only good outcomes will occur. When providing time estimates for various projects, include budgeted time for validation and debugging. How often has an unforseen problem arisen that delays the schedule?
If you want to build robust systems, keep Murphy's Law in mind.