Bridge


This is a pattern that allows you to separate a large class into several related classes -> you separate the abstraction and the implementation.

When you want to extend classes along two dimensions, it is better to transform inheritance into composition. For example, if I have a Shape class, which I want to extend according to Form and Color, it is better to extend it only according to Form and to make it have a Color.

Thus, when creating a Shape, we can pass it a Color as a parameter.

Applicability

META

Status:: #wiki/notes/mature
Plantations:: Structural Patterns - 20230221104007
References:: Design Patterns