Perfect Developer basic tutorial 1 This page last modified 2011-10-29 (JAC)

Verified Design By Contract

If Design-by-Contract is new to you, then by all means have a quick glance through this section now, but there's no need to try to take in everything. It will become clearer by the end of this set of tutorials.

Design By Contract

If you have been brought up on Design By Contract (e.g. as supported by Eiffel), then you have already taken a step towards Verified Design By Contract provided by Perfect. But there are some important differences between DBC and VDBC.

First of all, in VDBC contracts are expressed in terms of an abstract data model, which may be very different from the eventual implementation model. The abstract data model is the simplest possible way of describing the essence of the data that is stored, avoiding any kind of redundancy or over-specification.

Second, in VDBC contracts are complete. In other words, the contract provides everything the client needs to know about what the method does.

A corollary to this is that in Perfect, postconditions are complete; that is, they specify precisely what variables are changed and how they are changed. In contrast, an Eiffel postcondition merely specifies something that must be true when the method returns.

In order to provide for partial method specifications that are inherited even when a method is overridden, Perfect provides an additional construct: the postassertion. A postassertion specifies everything the client can assume even in the presence of polymorphism.

To summarize: in Perfect:

Next:  a Java example

 

Save My Place Glossary Language Reference Manual
Tutorials Overview Main site   
Copyright © 1997-2012 Escher Technologies Limited. All rights reserved. Information is subject to change without notice.