What should you do with 'fat' interfaces?

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

What should you do with 'fat' interfaces?

Explanation:
A fat interface packs many methods into one contract, which makes every client depend on more functionality than it actually needs. Exposing that interface through adapters is a practical way to give each client a lean, tailored surface while keeping the heavy interface intact behind the scenes. The adapter translates the smaller, client-focused calls into the appropriate calls on the fat interface, so clients don’t have to learn or depend on all those methods. This approach preserves backward compatibility with existing code, localizes changes to the adapter, and makes it easier to evolve the underlying API over time. In contexts where you can’t or don’t want to refactor the interface itself, using adapters provides a clean separation between what a client uses and how the system implements the fat interface. Splitting into smaller interfaces is another valid strategy in many cases, but adapters specifically address the need to present a usable surface without forcing a broad redesign.

A fat interface packs many methods into one contract, which makes every client depend on more functionality than it actually needs. Exposing that interface through adapters is a practical way to give each client a lean, tailored surface while keeping the heavy interface intact behind the scenes. The adapter translates the smaller, client-focused calls into the appropriate calls on the fat interface, so clients don’t have to learn or depend on all those methods. This approach preserves backward compatibility with existing code, localizes changes to the adapter, and makes it easier to evolve the underlying API over time.

In contexts where you can’t or don’t want to refactor the interface itself, using adapters provides a clean separation between what a client uses and how the system implements the fat interface. Splitting into smaller interfaces is another valid strategy in many cases, but adapters specifically address the need to present a usable surface without forcing a broad redesign.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy