Computer Science I / Debugging Structural Invariants
Practice question · Multiple choice

An invariant checker is written, run during development, and deleted before release. What was gained, and what was lost?

Hints
  1. Ask when the checker earns its keep: while the code is being written, or after it ships?
  2. Deleting and compiling out have the same runtime effect. What differs?
Show the answer

C. Bugs caught where they were caused, at no production cost

Why

The value is entirely in development, where it converts a distant symptom into an immediate one, so a released build loses nothing by omitting it. Compiling out rather than deleting keeps it available for the next change, which is exactly what assertion mechanisms are for.

Read the lesson: Debugging Structural Invariants →

Practise Debugging Structural Invariants

The app has 6 more questions on this lesson, and keeps your place in the course. Computer Science I is free to start.

More questions on Debugging Structural Invariants