Which practice aligns with ADP for module 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

Which practice aligns with ADP for module interfaces?

Explanation:
Depend on abstractions, not on concrete implementations. For module interfaces, the idea is to define a contract (an interface or abstract base) that callers rely on, and have concrete classes implement that contract. This creates loose coupling: callers don’t care which exact class they’re using, so you can swap in a different implementation, evolve the code, and test more easily with mocks or stubs. Relying on concrete classes ties modules together to specific implementations, making changes harder and reducing testability. Exposing implementation details publicly or avoiding interfaces breaks encapsulation and increases fragility, whereas programming to an abstraction keeps boundaries clean and flexible.

Depend on abstractions, not on concrete implementations. For module interfaces, the idea is to define a contract (an interface or abstract base) that callers rely on, and have concrete classes implement that contract. This creates loose coupling: callers don’t care which exact class they’re using, so you can swap in a different implementation, evolve the code, and test more easily with mocks or stubs. Relying on concrete classes ties modules together to specific implementations, making changes harder and reducing testability. Exposing implementation details publicly or avoiding interfaces breaks encapsulation and increases fragility, whereas programming to an abstraction keeps boundaries clean and flexible.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy