Chapter 6. Fine Print in Contracts

Contracts form a solid framework for arguing about the correctness ofImage 4 code: Class invariants capture the consistency of the objects’ internal structures, while the pre- and post-conditions of methods describe the objects’ behavior to clients without requiring knowledge of the objects’ internals. Within methods, the workings of the code can be traced in detail, down toImage 4.2.3 formalizing the effects of individual statements. 4.7

The presentation so far has established the terminology and common reasoning patterns. ...

Get How to Use Objects: Code and Concepts 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.