Objectives
This section intends to convince the student
of the importance of types.
Contracts, which allow for the expression of behavioral
properties, are introduced as a natural extension of
syntactic types.
The pragmatic consequences of subtyping are explained
by introducing the substitutability requirement.
Then, the notion of subtyping is lifted to
the level of behavioral properties
by explaining what is involved in refining a contract.
Points to emphasize
- types -- as an organizing principle
- contracts -- obligations and benefits
- subtyping -- the substitutability requirement
- partial types -- designed to have subtypes
slide: Objectives
Possible difficulties
The student may have some difficulties in grasping the relation
between types and contracts.
This relation is further explained in part III.
In particular, the notion of refining a contract
is hard to get across.
When in doubt, students tend to choose a covariant relation
between method pre-conditions, instead of a contravariant
relation.
The only remedy, apart from rote learning,
seems to be to elaborate on the metaphor of improving
a service in business.
Questions
- Explain how you may characterize the behavior of an
object by means of a contract.
- What benefits may design by contract have for system developers? And for users?
- What are partial types? How may they be employed?
- Give a detailed account of the issues that
arise in refining a contract.
slide: Questions
Comments
This section continues the major theme as
introduced in section [theme].
The theme is further elaborated in part III,
where the relationship between syntactic and behavioral
(sub)types is examined in depth.
The intuition underlying our interpretation of
types is essentially types as constraints.