Unit 10 · overview

Unit 10: Interfaces and Behavioral Contracts

Object-oriented design becomes more flexible when one component can depend on a capability rather than the exact class providing it.

Java interfaces give that capability a type.

This unit focuses on:

  • interface contracts;
  • multiple implementations of one capability;
  • variables and parameters typed to an interface;
  • substituting implementations without rewriting callers;
  • testing whether an implementation actually preserves the promised behavior.

The goal is not to create interfaces everywhere. It is to use one when a stable capability boundary makes collaboration easier to reason about.