Why?

Assertion usage is a subject which even amongst very experienced developers will spark an intense discussion. There's really no good way to determine who is right or wrong and how right or wrong. One of the reasonable strategies is to reference people who are well-known authority figures in the world of (commercial) software development and use whatever they've published as means to reach consensus.

Below is my personal list of references when it comes to that matter.

Reference books

In order of my own perceived importance:

  1. Steve Maguire. "Writing Solid Code". Chapter 2: Assert Yourself. Page 13.
  2. Steve McConnell. "Code Complete: A Practical Handbook of Software Construction".  Chapter 8: Defensive Programming. Section 8.2: Assertions. Page 189.
  3. John Robbins. "Debugging Microsoft .NET 2.0 Applications". Chapter 3: Debugging During Coding. Section: Assert, Assert, Assert, and Assert. Page 90.
  4. David Thielen. "No Bugs!: Delivering Error-Free Code in C and C++".  Chapter 5: Assert the World. Page 39.
  5. Brian W. Kernighan and Rob Pike. "The Practice of Programming". Chapter 6: Testing. Section 6.1: Test as You Write the Code. Page 142.