Tagged articles

Object Composition

1 articles · Page 1 of 1
Nullbody Notes
Nullbody Notes
Jan 12, 2021 · Fundamentals

How to Dynamically Add Features in Go Using the Decorator Pattern

The article explains the Decorator pattern in Go, defining it as a way to add behavior to objects without altering their structure, illustrates the concept with everyday analogies and provides complete Go code examples—including a basic Showable interface, a plain Girl struct, and makeup decorators that wrap the original object—to demonstrate how layered decorations work transparently at runtime.

Decorator PatternDesign PatternsGo
0 likes · 4 min read
How to Dynamically Add Features in Go Using the Decorator Pattern