7. Judging Specifications

Suppose you want to substitute one method for another. How do you compare the specifications?

A specification A is at least as strong as a specification B if

For example, the method maybePrime can be replaced in any context by a method isPrime that returns true if and only if the integer is prime.

There are no infallible rules to write specifications, but there are some useful guidelines: