Chapter 3. Structural Patterns - Composite, Adapter, and Bridge Design Patterns
We are going to start our journey through the world of structural patterns. Structural patterns, as the name implies, help us to shape our applications with commonly used structures and relationships.
The Go language, by nature, encourages use of composition almost exclusively by its lack of inheritance. Because of this, we have been using the Composite design pattern extensively until now, so let's start by defining the Composite design pattern.
Composite design pattern
The Composite design pattern favors composition (commonly defined as a has a relationship) over inheritance (an is a relationship). The composition over inheritance approach has been a source of discussions ...