/** * @effects: returns a random int **/ int foo ();Would the implementation
int foo() {
return 3;
}
satisfiy it?
Question: I don't understand the difference between cohesion
and coupling.
Answer: In lecture cohesion was used to describe how well a
certain module in a program fits together. All of the operations
should be related and the module should function cleanly and make
sense as a unit. Coupling was used to describe the connection between
different modules. These connections tend to be fewer and looser and
generally are desired to be kept to a minimum.
The words really aren't that important; the real point was that a well designed system contains many components. Most of the interactions in the system should be between parts of a given component, and the number of interactions between separate components should be much fewer.
Question: Can we treat all of the specifications we write as
being restricted to the domain specified by the requires?
Answer: Of course. That's the whole point to having a requires
clause. :)
Question: When is one spec stronger than another?
Answer: One spec is strong then another when it permits fewer
implementations. Essentially if all possible implementations of spec
A are also valid implementations of spec B, then spec A is stronger
than spec B.
Question: When does a transition set satisfy a specification?
Answer: When the transition set for an implementation is a
subset of the transition spec for a specification then the
implementation satisfies the spec.
This could becoming confusing, however, if you consider the specifications transition set to only include transitions for the cases when the precondition was valid. If, however, you include in the specification all transitions from any state with an invalid precondition to any state whatsoever, then any implementation which has a transition set which is a subset is a valid implementation.