Defensive Programming Pattern
(Redirected from Defensive Programming)
Jump to navigation
Jump to search
A Defensive Programming Pattern is a software programming pattern that follows a defensive design (intended to ensure the continuing function of a piece of software under unforeseen circumstances).
- See: Exception Handling, High Availability, Safety, Computer Security, Software Bug, Source Code, Code Audit.
References
2020
- (Wikipedia, 2020) ⇒ https://en.wikipedia.org/wiki/Defensive_programming Retrieved:2020-8-19.
- Defensive programming is a form of defensive design intended to ensure the continuing function of a piece of software under unforeseen circumstances. Defensive programming practices are often used where high availability, safety, or security is needed.
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.
- Overly defensive programming, however, may safeguard against errors that will never be encountered, thus incurring run-time and maintenance costs. There is also a risk that code traps prevent too many exceptions, potentially resulting in unnoticed, incorrect results.
- Defensive programming is a form of defensive design intended to ensure the continuing function of a piece of software under unforeseen circumstances. Defensive programming practices are often used where high availability, safety, or security is needed.