Design principles in Architecture Interface Separation principle (ISP)-Java Development Technology-experience the beauty of design patterns and algorithms in architecture

Source: Internet
Author: User


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.

    1. 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.

    2. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.