We are now reaching the part that people usually associate with Defensive Programming: Code Safety. As I mentioned previously, often considered to be the only subject in defensive programming, as you have seen, it represents only a small subset of the subject as a whole.
Code safety generally consists of two steps, typically: Assertions and Guard Clauses.
Assertions
Assertions are available in most modern languages and are used to ensure that assumptions are met and enforced when a func...
Published on April 25, 2022 08:00