Factory pattern advantage regarding coupling?

Prepare for the Object-Oriented Programming Test with flashcards and multiple choice questions. Each question comes with hints and explanations to enhance understanding. Master OOP concepts and succeed in your exam!

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