MΓ³dulo 23 Β· Design Patterns (All 23 GoF) β LecciΓ³n 2 de 23 Β· ~6 min
Factory Method
Factory Method: a method picks the concrete class
Problem: callers should ask for what they want, not know which class builds it.
PawWalk scenario: a booking update goes out over email, SMS, or push. A single notifier_for(channel) returns the right notifier; the rest of the code just calls .notify.
In Ruby this is often a plain case in one method β no Creator subclass hierarchy needed. That IS the factory method.