Pinwheel, strategy, factory patrern
This presentation focuses on why and where patterns are used in real systems.
Not textbook definitions.
Examples are from messaging / SMS / transactions.
Factory is about deferring object creation.
Example: createSmsSender(type).
Client code avoids new ProviderA().
Helps centralize construction rules.
Abstract Factory is useful when multiple objects must be consistent.
Example: SMS provider + credentials + formatter.
You switch entire provider stack, not just one class.
Decorator solves inheritance explosion.
Example: Send SMS with retry + audit + metrics.
Each decorator does one thing and wraps execution.
Bridge is often confused with Strategy.
Example: Message abstraction (SMS, Email) vs Transport (HTTP, SMPP).
Both vary independently.
Bad inheritance: IceWithSalt extends Ice.
Better aggregation: Ice has Additive (salt, lemon).
Aggregation avoids rigid class hierarchies.
Modern systems prefer composition.
Click-to-view means assemble behavior when needed.
This leads to pinwheel-style designs.
Pinwheel is not a GoF pattern.
It is a composition style.
Core does the main work, spokes add cross-cutting behavior.
Think of execution as wind.
Each blade reacts independently.
No blade knows about others.
Core = actual provider call.
Strategy selects provider.
Decorators wrap execution.
Abstract Factory creates provider stack.
Pinwheel is superior to AOP for per-transaction behavior.
Debugging is easier.
Behavior is visible and testable.
- Log in to post comments