The benefits of java interfaces

1> Importance: In the Java language, abstract class and interface are two mechanisms that support abstract class definitions. It is precisely because of the existence of these two mechanisms that Java has powerful object-oriented capabilities.

2>Simple and normative: If a project is relatively large, then an architect who can sort out all the business is needed to define some main interfaces, which not only tell developers what businesses you need to implement, but also limit the naming conventions Live (to prevent some developers from naming them so that other programmers can't understand them).

3>Maintenance and expansion: For example, if you want to make a drawing board program, there is a panel class in it, which is mainly responsible for the drawing function, and then you define this class like this.

         But in the near future, you suddenly find that this class can no longer satisfy you, and then you have to redesign this class, or even worse, you may have to give up this class, so it may be referenced in other places, so it is very troublesome to modify.

4> Security and rigor: The interface is an important means to realize the loose coupling of software. It describes all the external services of the system without involving any specific implementation details. This is safer and more rigorous (generally, software service providers consider it more).

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325834750&siteId=291194637