☆Interface isolation principle, it is better to use multiple special interfaces than to use a single total interface. In other words, from the perspective of a customer, the dependency of a class on another class should be built on the minimum interface.
9.1 what is interface isolation principle
☆The interface isolation principle is to provide different interfaces with different width and width for the same role to meet the requirements of different clients. The following example uses set as an example:
In this UML diagram, treeset is a sortable set container that uses a tree data structure. It implements both the Set interface (inherited abstractset) and the sortedset interface. This does not provide a general interface with both sorting and set functions. Instead, the two roles are defined as two interfaces based on different requirements, is in line with the interface isolation principle.
☆Interface pollution
Merging interfaces of different roles into a bloated interface is a pollution to the interface. This practice also violates the variability encapsulation principle, which encapsulates different variability into the same software entity.
☆For specific applications of the interface isolation principle, refer to the memorandum mode and iteration mode.