Defensive Programming Examples
•
Use
boolean
variable
not
integer
•
Test
i
<=
n
not
i
= =
n
•
Assertion checking
•
Build debugging code into program with a switch to
display values at interfaces
•
Error checking codes in data, e.g., checksum or hash
24