Design patterns·Wrapping and composing
you had shapes and renderers and were about to write one class per combination, so you gave each shape a renderer field.
Bridge pattern
Also calledbridge, handle-body, abstraction and implementation split
Splitting an abstraction from its implementation so the two can vary independently, turning a product of subclasses into a sum. It is the answer to subclass explosion across two axes, and unlike the adapter it is designed in up front rather than retrofitted between things that already exist. Most people meet it without the name — any class that holds a strategy for how it does its work is halfway to a bridge.