Definition
Assertive programming is the habit of writing assertions: statements that declare a condition you are certain must hold at a given point in the code. If the condition is ever false, the program halts loudly instead of continuing in a corrupted state.
The guiding maxim is simple: if it can never happen, use an assertion to ensure that it will not. Assertions document your assumptions in executable form and catch the moment those assumptions break.
Why it matters
How it works
You place an assertion wherever you rely on something being true that the type system or surrounding logic does not guarantee: a value is non-negative, a list is sorted, a pointer is not null. When the assumption is violated, the assertion fails with a clear message at the exact failure site.
Assertions check things that should never happen; they are not a substitute for handling errors that genuinely can occur, such as bad user input. They also should not have side effects, since some build configurations strip them out. Used well, an assertion is a tripwire that exposes a logic defect the instant it appears.