reading-notes

View on GitHub

What is an Interface?

What problem does the interface solve?

The basic problem an interface is trying to solve is to separate how we use something from how it is implemented.

Interfaces are trying to solve a very specific problem by allowing us to interact with objects based on what they do, not how they do it.

Interfaces are contracts

Interfaces allow us to specify that a particular class meets certain expectations that other classes can rely on.

When a class implements an interface, it does not mean that class IS that interface. For this reason interfaces that completely describe the functionality of a class are usually wrong.

A class can implement multiple interfaces because each interface only talks about a particular contract that class is able to fulfill.