4 Designing contracts
This chapter covers
- Designing pre-conditions, post-conditions, and invariants
- Understanding the differences between contracts and validation
Imagine a piece of software that handles a very complex financial process. For that big routine to happen, the software system chains calls to several subroutines (or classes) in a complex flow of information: that is, the results of one class are passed to the next class, whose results are again passed to the next class, and so on. As usual, the data comes from different sources, such as databases, external web services, and users. At some point in the routine, the class TaxCalculator
(which handles calculating a specific tax) is called. From the requirements of this class, the calculation ...
Get Effective Software Testing 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.