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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.