Mid
From PDF
GoF Patterns
Gang of Four Patterns
Dynamic Factory Selection:?
Short answer: In a more advanced system, you could dynamically choose which factory to use based on external configurations, like settings or environment variables. This would enable the system to switch between different logging mechanisms or database connections without recompiling the application.
Real-world example (ShopNest)
ShopNest’s NotificationFactory creates Email or SMS senders based on user preference.
Say this in the interview
- Define — one clear sentence (the short answer above).
- Example — relate it to a project like ShopNest or your real work.
- Trade-off — when you would not use it.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png