32.12. Time Intervals and Product PricesFixing an Iteration 1 "Error"
In the first iteration, SalesLineItems were associated with ProductDescriptions , that recorded the price of an item. This was a reasonable simplification for early iterations, but needs to be amended. It raises the interestingand widely applicableissue of time intervals associated with information, contracts, and the like.If a SalesLineItem always retrieved the current price recorded in a ProductDescriptions , then when the price was changed in the object, old sales would refer to new prices, which is incorrect. What is needed is a distinction between the historical price when the sale was made, and the current price.Depending on the information requirements, there are at least two ways to model this. One is to simply copy the product price into the SalesLineItem , and maintain the current price in the ProductDescriptions .The other approach, more robust, is to associate a collection of ProductPrices with a ProductDescriptions , each with an associated applicable time interval. Thus, the organization can record all past prices (to resolve the sale price problem, and for trend analysis) and also record future planned prices (see Figure 32.19). See [CLD99] for a broader discussion of time intervals, under the category of Moment-Interval archetypes.