Defensive programming is a form of defensive design intended to ensure the continuing function of a piece of software in spite of unforeseeable usage of said software. The idea can be viewed as reducing or eliminating the prospect of Murphy's Law having effect. Defensive programming techniques are used especially when a piece of software could be misused mischievously or inadvertently to catastrophic effect.
Defensive programming is an approach to improve software and source code, in terms of:
- General quality - Reducing the number of software bugs and problems.
- Making the source code comprehensible - the source code should be readable and understandable so it is approved in a code audit.
- Making the software behave in a predictable manner despite unexpected inputs or user actions.
Other articles related to "defensive programming, programming":
... function, doing a check of object state (in Object-oriented programming languages) or other held data and the return value before exits (break/return/throw/error code) is also wise ... With the advent of logging libraries and Aspect Oriented Programming, many of the tedious aspects of defensive programming are mitigated ...
Famous quotes containing the words programming and/or defensive:
“If there is a price to pay for the privilege of spending the early years of child rearing in the drivers seat, it is our reluctance, our inability, to tolerate being demoted to the backseat. Spurred by our success in programming our children during the preschool years, we may find it difficult to forgo in later states the level of control that once afforded us so much satisfaction.”
—Melinda M. Marshall (20th century)
“What is clear is that Christianity directed increased attention to childhood. For the first time in history it seemed important to decide what the moral status of children was. In the midst of this sometimes excessive concern, a new sympathy for children was promoted. Sometimes this meant criticizing adults. . . . So far as parents were put on the defensive in this way, the beginning of the Christian era marks a revolution in the childs status.”
—C. John Sommerville (20th century)