Design by contract

Design by contract [Meyer] describes the responsibilities of the calling and called components, by describing the preconditions, post-conditions, and parameters for each service invocation. This is the most important aspect of documenting a component, so that it can be easily used and reused.

Preconditions express the constraints for a service to operate properly, and the post-conditions express the state of the component after the service has been invoked successfully. This then defines the benefits and obligations for the supplier and consumer of the service: the contract. If the obligations are not fulfiled, then the contract has been broken.

During design of a component or service, the preconditions and post-conditions ...

Get Service- and Component-based Development: Using Select Perspective™ and UML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.