Solution

Let's consider a simple framework to allow additional prices for a setup and reconfiguration by parts. We would also like to be able to display a description/invoice of parts. This framework will be more than a simple select from a product list; it should allow us to ensure that a valid configuration is built. Let's start by considering the major entities:

Parts: A part is an entity that may be sold.

  1. All parts consume and provide resources.

  2. All parts have a name.

  3. All parts have a description.

  4. All parts have a price (either fixed or set by an algorithm).

  5. Complex parts may be composed of other parts.

Resources: A resource is any entity that is provided or consumed by a part.

  1. A resource has a name.

  2. A resource has a quantity.

Configuration:

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.