July 2001
Intermediate to advanced
656 pages
15h 51m
English
Assume that a payment can either be in an unauthorized or authorized state, and it is meaningful to show this in the domain model (it may not really be, but assume so for the discussion). As shown in Figure 26.13, one modeling approach is to define subclasses of Payment: UnauthorizedPayment and AuthorizedPayment. However, note that a payment does not stay in one of these states; it typically transitions from unauthorized to authorized. This leads to the following guideline:
|
Do not model the states of a concept X as subclasses of X. Rather, either:
|
Read now
Unlock full access