Builder Patterns

· go's blog


Why? #

Sometimes a simple constructor gets a bit out of hand. You start with a simple func New(name string) and suddenly you're looking at func New(name string, color string, enabled bool, cows int) and you're not sure how you got here.

Solution #

Move optional