O'Reilly logo

Joy of Patterns: Using Patterns for Enterprise Development, The by Brandon Goldfedder

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required