There are common situations when classes differ only in their behavior. For this case is a good idea to isolate the algorithms in separate classes in order to have the ability to select different algorithms at runtime.
Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from client that use it.
Implementation in GO :
Extract common behavior from algorithms and put them into an interface. For each different algorithm to implement the interface.
「Mr WordPress」對「Hello world!」留言