Factory vs Abstract Factory with practical example
Reported in Graphcore European engineering loops. Design pattern comparison frequently asked in OOD interviews.
Interview scenario
Often asked in Graphcore loops at European offices (London, Berlin, Amsterdam, Paris, Stockholm, Dublin, and remote EU). Prepare a clear spoken answer plus key trade-offs.
Model answer
Try answering aloud first
Cover trade-offs, structure, and a concrete example before revealing the baseline response.
How to frame this at Graphcore: Connect your answer to measurable impact, clarity of thought, and trade-offs the team cares about. Below is a strong baseline response you can adapt with your own project examples.
A Factory Method creates one product type through a common creation interface, often letting subclasses decide concrete implementation. It is useful when object creation logic should be centralized but product family is narrow.
Abstract Factory creates related product families together, such as UI components for dark and light themes. It guarantees compatible combinations without exposing concrete classes to client code.
Keep explanation grounded in a real domain, then discuss trade-off: stronger decoupling versus added abstraction complexity.
Discussion
Comments (0)
Share how this question came up in your loop, or add tips for others preparing.
Log in to comment on this question.