Tag: design patterns

Strategy Pattern in Golang

Introduction The strategy is a behavior pattern. It fits where multiple choices for an interface are available and the design would allow switching them dynamically. Conditions A set of choices with similarity in the interface Dynamic update of a choice Example A cache with evictions Multiple eviction algorithms Cache could switch to a different algorithm dynamically A duck type has…