Assertion Context
In this lesson, we will briefly explain the Assertion Context idiom.
We'll cover the following...
Problem Context
Assertions are a powerful programming tool that must not be confused with error handling. Instead, we should primarily use them to state something that is known to be true due to a surrounding context.
Validating function arguments is good programming practice and so is high cohesion. To simplify functions and increase their cohesion we often have them delegate to small, internal functions. When passing around pointers, we validate them once, pass them on and state that we know they are valid with an ...