Interface

Programming

In software, an interface defines a contract that specifies how components should interact. It typically lists methods or behaviors without specifying how they are implemented. Interfaces allow developers to write code that depends on abstractions rather than concrete implementations, improving flexibility and testability. They are central to object-oriented and component-based design.

Why it matters

Interfaces help decouple systems, enabling easier refactoring and substitution of components. They also improve clarity by documenting expected behavior, particularly in large codebases or distributed systems. Interfaces are heavily used in typed languages and API design.

Examples

A payment processor interface might define a charge(amount) method that different implementations fulfill. Lessons like Clear Interfaces and Contracts explain how interfaces support maintainable architectures.

See More

Further Reading