topics/go/design/composition/README.md
Composition goes beyond the mechanics of type embedding and is more than just a paradigm. It is the key for maintaining stability in your software by having the ability to adapt to the data and transformation changes that are coming.
"A good API is not just easy to use but also hard to misuse." - JBD
"You can always embed, but you cannot decompose big interfaces once they are out there. Keep interfaces small." - JBD
"Don't design with interfaces, discover them." - Rob Pike
"Duplication is far cheaper than the wrong abstraction. - Sandi Metz
Repeat yourself, do more than one thing, and rewrite everything - tef
Embedding
Methods, Interfaces and Embedding - William Kennedy
Composition In Go - William Kennedy
Reducing Type Hierarchies - William Kennedy
Avoid Interface Pollution - William Kennedy
Grouping By State (Go Playground)
Grouping By Behavior (Go Playground)
Struct Composition (Go Playground)
Decoupling With Interface (Go Playground)
Interface Composition (Go Playground)
Decoupling With Interface Composition (Go Playground)
Remove Interface Pollution (Go Playground)
More Precise API (Go Playground)
Interface Conversions (Go Playground)
Runtime Type Assertions (Go Playground)
Behavior Changes (Go Playground)
Create Interface Pollution (Go Playground)
Remove Interface Pollution (Go Playground)
Package To Mock (Go Playground)
Client (Go Playground)
Using the template, declare a set of concrete types that implement the set of predefined interface types. Then create values of these types and use them to complete a set of predefined tasks.
Template (Go Playground) | Answer (Go Playground)
All material is licensed under the Apache License Version 2.0, January 2004.