In secure programming (synonym: defensive programming), the goal is to ensure continuing function of software despite any and all unforeseen use(s). This may be viewed as reducing or eliminating the prospect of Murphy's Law working. It is most valuable when software can be misused accidently or intentionally, to catastrophic effect.

Nothing is assumed: all error states are accounted for and handled. Programmers never assume a given function call or library will work as promised, and so handle it in the code. In contrast, in normal programming practices, many such assumptions are made.