Example of Strategy Pattern in Golang

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 similarities in the interface
  • Dynamic update of a choice

Example

  1. A cache with evictions
  • Multiple eviction algorithms
  • A cache could switch to a different…

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store