Módulo 15 · Design Patterns in Go — Lección 3 de 8 · ~6 min
Factory
A constructor that returns an interface
Factory hides which concrete type gets built behind a function that returns an interface. When a booking changes, PawWalk notifies the owner — by SMS, email, or push. Callers shouldn't scatter if channel == ... everywhere; they ask a factory for a Notifier and call Send.
This is where Go's implicit interfaces shine: SMSNotifier and EmailNotifier never declare that they implement Notifier — having the right method is enough. The factory returns the interface; the concrete type is an implementation detail the caller never sees.