Interface Separation principle
The core idea of the interface separation principle is that client programs should not be forced to rely on methods that they do not need to use. The English abbreviation ISP, namely interface segregation Principle. In fact, the interface separation principle means: an interface does not need to provide too much behavior, an interface should only provide an external function, should not be all operations are encapsulated in an interface.
The "interface" here refers not only to the interface defined by the interface keyword, the interface is divided into the following two kinds.
-
object interface. A class declared in Java, an instance of the New keyword, is a description of a type of thing, which is also an interface.
-
class interface. This interface is the interface defined by the keyword interface.
The interface is as small as possible: the interface is as small as possible, mainly to ensure that an interface serves only one submodule or business logic.
Interface high cohesion: Interface high cohesion is internally highly dependent and isolated as much as possible. That is, the method of internal declaration of an interface is related to a sub-module, and is required by this submodule.
Interface design is limited: If you fully follow the principle of interface separation, there will be a problem, that is, the design of the interface will be less and less, so that the number of interface increases, the complexity of the system increased suddenly, rather than the real project needs, so in the use of this principle, but also in the specific project, Judging by experience or attempt, but without a fixed standard.
Design principles in Architecture Interface Separation principle (ISP)-Java Development Technology-experience the beauty of design patterns and algorithms in architecture