Practical Design Pattern in Go: Functional Options

The Functional Options Pattern is a design pattern for creating objects with flexible configurations by using functions as arguments to modify the default behavior. In my opinion, this pattern can be considered a Builder Pattern with a functional style: instead of chaining methods, we compose functions to configure the object. This pattern is widely used in Go, which might be the reason it is not explained in most design pattern books....

October 30, 2023 · 7 min · 1428 words · Jose Sitanggang