All books

Professional

Apps About Coach Log in Start reading

Computer Science · Glossary

What is Defensive programming?

Definition 7.11 University Computer Science — Year 1 · Chapter 7 — Modular Programs, Makefiles and Tests

Defensive programming is writing each function so that it detects the situations it was not designed for, instead of computing garbage from them: it checks what it receives from outside the program and returns an error, and it asserts what its callers must guarantee.

Read in context →