17.6. Object Design: endSale
The endSale system operation occurs when a cashier presses a button indicating the end of a sale. Here is the contract:
Contract CO3: endSale
|
Choosing the Controller Class
Our first choice involves handling the responsibility for the system operation message endSale. Based on the Controller GRASP pattern, as for enterItem, we will continue to use Register as a controller.
Setting the Sale.isComplete Attribute
The contract postconditions state:
Sale.isComplete became true (attribute modification).
As always, Expert should be the first pattern considered ...
Get Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, Second Edition 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.