Free Online Flashcard Deck

6 Interfaces and Abstract Types Free Online FlashCards

Study 6 Interfaces and Abstract Types with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is an abstract type?

Back

An abstract type describes what an object can do without requiring its complete representation or implementation.

02
Front

What is an interface?

Back

An interface is a named contract that specifies operations an implementing type promises to provide.

03
Front

What does a complete interface contract specify?

Back

A complete interface contract includes names and signatures, input and output rules, behavioral expectations, failure behavior, and state or side-effect expectations.

04
Front

What must an interface implementation satisfy?

Back

An implementing type must satisfy both the syntactic contract and the behavioral contract of the interface.

05
Front

How does polymorphism apply to interfaces?

Back

Polymorphism lets client code use the same interface operation with different concrete implementations, each producing implementation-specific behavior.

06
Front

What is an abstract class?

Back

An abstract class is a partially implemented base class that may provide state, constructors, implemented methods, and abstract methods for subclasses to complete.

07
Front

When should you choose an interface over an abstract class?

Back

Use an interface for a capability or contract across potentially unrelated types; use an abstract class when related types need shared state or implementation.

08
Front

What does the dependency inversion principle recommend?

Back

Dependency inversion means high-level policy depends on abstractions, while low-level implementations conform to those abstractions.

09
Front

What is dependency injection?

Back

Dependency injection supplies a concrete implementation to a client through a constructor, factory, configuration object, or framework.

10
Front

When are implementations interchangeable?

Back

Implementations are interchangeable when a client can replace one with another without violating the client's assumptions or the shared contract.

11
Front

Why should interfaces remain focused?

Back

A focused interface represents one coherent responsibility, such as separate Reader and Writer capabilities, instead of forcing unrelated operations together.

12
Front

What does it mean to design around client needs?

Back

Design an interface around the operations clients actually need, rather than exposing every operation available on the concrete object.