Skip to content

Specification-Implementation Gap Analysis

Why It Matters

Most bugs aren't coding errors but mismatches between specification and implementation. Code that perfectly implements the wrong specification is still wrong. Code that does something not in the specification may break things that depend on spec compliance. Finding these gaps reveals either implementation bugs or specification deficiencies.

The Key Move

For any implemented system, align specification and implementation side-by-side. For each specified behavior, trace it to implementation: is it there? correct? For each implemented behavior, trace it to specification: is it specified? allowed? For gaps, determine which is wrong: fix the implementation or revise the specification.

Classic Application

Conformance testing. Hardware implementations of instruction set architectures are tested against the formal specification. A CPU that correctly implements an unspecified corner case might be doing something clever - or might break software that assumed different unspecified behavior. The gap must be resolved: specify it or remove it.

Surprising Application

Job role clarity. Your job description (specification) and your actual activities (implementation) often diverge. Gap analysis: What are you doing that's not in your job description? (Scope creep or valuable initiative?) What's in your description that you're not doing? (Delegation or neglect?) Resolve by updating the description or changing behavior.

Failure Modes

Specification drift - using outdated specification, making gap analysis meaningless. Implementation detail obsession - flagging gaps in low-level details not meant to be specified. Specification ambiguity - can't determine if implementation matches because specification is unclear. Treating all gaps as implementation bugs when some indicate specification errors.

Go Deeper

Wing, "A Specifier's Introduction to Formal Methods" (1990); Jackson, "The Meaning of Requirements" (2011)