Factory pattern advantage regarding coupling?

Get ready for your Object‑Oriented Programming Test. Use flashcards and multiple-choice questions. Each question includes hints and explanations. Prepare for your exam today!

Multiple Choice

Factory pattern advantage regarding coupling?

Explanation:
The main idea here is that the Factory pattern reduces coupling by moving object creation behind a factory, so the client works with an abstraction rather than a concrete class. The client uses a product interface and doesn’t need to know which concrete product is produced. The factory encapsulates that decision, so changing the concrete product or adding new ones won’t require changing the client code. This is why it’s best described as avoiding tight coupling between the creator and the concrete product classes—you can swap in different implementations without touching the client. The other possibilities would imply more knowledge about concrete types or exposing details of how objects are created, which the Factory pattern intentionally avoids.

The main idea here is that the Factory pattern reduces coupling by moving object creation behind a factory, so the client works with an abstraction rather than a concrete class. The client uses a product interface and doesn’t need to know which concrete product is produced. The factory encapsulates that decision, so changing the concrete product or adding new ones won’t require changing the client code. This is why it’s best described as avoiding tight coupling between the creator and the concrete product classes—you can swap in different implementations without touching the client.

The other possibilities would imply more knowledge about concrete types or exposing details of how objects are created, which the Factory pattern intentionally avoids.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy