Solution: Layering Your System

Use layers to structure applications made up of groups of subtasks that are all at the same level of abstraction or that represent common groupings of responsibilities.

Exploring the effects of layers

The primary benefit of a layered architecture is enhanced maintainability. Each layer interacts only with an adjacent layer — primarily the layer below it. This arrangement means that layers may be modified, extended, and changed without creating problems for the other layers.

In the next two sections, I tell you about some other benefits and liabilities of layered-style architectures.

Benefits

Maintainability is the main benefit of layered architectures. There are other benefits, however, including the following:

images Layering your shipments

Suppose you want to ship your bike somewhere — maybe home after a long, one-way charity bike ride. You can find people to disassemble it, pack the pieces, prepare the boxes for shipment, and move the boxes to your home. At the other end, there are people you can hire to reverse these tasks. Each of these people corresponds to a layer in your overall plan for shipping your bike.

The layers are all specialized at their task—the packer may not know how to reassemble the bike. In fact, the different layers can do what they do for things other than just bikes. Each of the people needs to know who they'll receive their work ...

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.