Sunday, February 26, 2006
The many uses of DbC
Design by Contract, how do I love thee, let me count the ways...
- DbC is a documentation tool. It specifies the behaviour of a class concisely and precisely.
- DbC is a design tool. The application is specified by means of classes equipped with assertions (I call this Contract Driven Design, or CoDD).
- DbC is an enhancement tool. Assertions can be added to existing code to make it more robust. I call this Contract Hardening, or CoHa.
- DbC is a maintenance tool. Assertions can be added to existing code to confirm (or improve) understanding of the behaviour of existing code prior to changes being made.
- DbC is a refactoring tool. Assertions make sure that desirable behaviour is retained even in the face of extensive refactoring. Eiffel code is so malleable when it is contract-equipped.
- Dbc is a correctness tool. Assertions in parent classes help ensure that child classes (which inherit the parents' assertions) are substitutable.
- DbC is an error-handling tool. Assertions define the success or failure of a routine and direct its error recovery during exception handling.
- DbC is a concurrency tool. Well, it will be when SCOOP is implemented, where preconditions play a key role in synchronization.
Comments:
<< Home
One more: DbC is a testing tool. It enables a tool like AutoTest to stress-test your code for you, based on the contracts that you have specified.
Project management tool by maintaining and enforcing specifications and other prior work. This was discussed in an article on Eiffel in HP color printers.
-- Jussi
Post a Comment
-- Jussi
<< Home