[JAVA] Simply consider "why use interface"

It is to simplify the mounting and promote the componentization.

The interface is responsible for connecting or separating the chaotic ** real world ** from the strict ** computer world **. To make it easier to make parts, implementation is as simple as possible, and interface blocks complexity!

Reasons to allow multiple inheritance in interface and not in general classes

Since interface describes business ** specifications ** that are close to the chaotic real world, it replaces the complexity of implementation-level general classes by allowing multiple inheritance.


It is the designer who defines the relationships and conditions between the interfaces. The implementer simply codes according to the design without being aware of the complexity of the business. However, it is important to be careful not to bring implementation (processing) conditions into the interface. On the contrary, it is important to be careful not to bring (business) conditions between intefaces into the implementation (processing). To that end, the interface allows multiple inheritance to represent complexity, and the implementation limits multiple inheritance to prevent complexity.

In addition, the ** function ** that associates business and processing is both ** common language **.

Recommended Posts

Simply consider "why use interface"
Why we use Docker
Why use orchestration tools with Docker