Mid
From PDF
GoF Patterns
Gang of Four Patterns
Database Connections:?
Short answer: In enterprise applications, a Factory Method can be used to instantiate different types of database connection objects (e.g., SQL Server, MySQL, Oracle) based on user preferences or configuration settings. The client code interacts with the database connection factory, and the factory returns the correct type of connection.
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