liveBook · Manning

Design pattern

As explained in Microservices Patterns, Second Edition

A design pattern is a reusable solution to a recurring software design problem, often expressed through collaborating object-oriented elements.

A design pattern solves a recurring software architecture or design problem by defining collaborating software elements. Its applicability depends on the context. section 7.6.1

In an object-oriented Strategy solution:

  • An interface encapsulates the algorithm; concrete strategies implement it for different contexts; a client class uses the algorithm. section 7.6.1

Bank overdraft policies

An Account can use different overdraft strategies to support policies with varying limits and fees. section 7.6.1

Figure 7.11 The visual representation of different types of relationships between the patterns: a successor pattern solves a problem created by applying the predecessor pattern; two or more patterns can be alternative solutions to the same problem; one pattern can be a specialization of another pattern; and patterns that solve problems in the same area can be grouped, or generalized.
PatternRelationships

Patterns can relate as successors, alternatives, specializations, or members of a generalized group. section 7.6.1

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines patterns through collaborating elements and outlines Strategy components without detailing implementation.
Examples
Uses banking overdraft policies with varying limits and fees to illustrate Strategy.
What you can do after
Evaluate a reusable solution by checking the context in which it applies.
How it connects
Connects design patterns to pattern languages, object-oriented design, and the Strategy pattern.

Also explained in

Compare how 9 books explain design pattern →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.