A Quick Example

Let's take a simple example: Say we want to start allowing complex pricing to be used for objects in our earlier Product Configuration example (see page 45). Specifically, I would like to support three pricing alternatives: a fixed price, a price computed by summing the subparts, and a real-time price that consults an external database for the price. If you recall, our final high-level solution looked liked that in Figure 8.1.

Figure 8.1. Product Configuration example

It should be fairly straightforward to understand that the pricing calculation needs to affect only the part hierarchy. But how do we provide a way in which to allow ...

Get Joy of Patterns: Using Patterns for Enterprise Development, The 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.