Implementing the Whole-Part Pattern

Five steps are involved in implementing the Whole-Part pattern, as you see in the following sections.

images

As you design the whole, you'll revisit earlier decisions and make refinements, so you should iterate and jump around during these steps rather than march through them in strict order.

Step 1: Define the whole's public interface

In this step, you define what the whole does — what the client is going to expect from the whole. In this step, you focus on the interface from the client to the whole regardless of where the functionality is provided — from the whole or from a part — and ignore functionality from the parts that are used only internally.

Step 2: Divide the whole into parts

The parts inside a whole can be derived and isolated in several ways:

  • Top-down: In the top-down approach, you start with the whole and work downward, uncovering the parts that you need to implement the whole's functionality. The partitioning is driven by the services that the whole offers to the client.

    images

    Finding all the whole's functionality can be hard if you're reusing existing components as the parts.

    images

    The parts and the whole can become tightly coupled due to the nature ...

Get Pattern-Oriented Software Architecture For Dummies 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.