Java EE application built based on SSH2 framework (3)

Source: Internet
Author: User

V. Interface-Oriented Programming


In my opinion, the most attractive feature of Object-Oriented Programming (OOP) for development technology improvement is the most influential interface. The interface defines a set of norms or standards, and how it is implemented depends on its implementation class, this provides developers with sufficient flexibility, greatly enhancing the system plasticity, and providing developers with more advanced and effective scalability. JDBC is one of the most typical examples of interface applications. Java JDK defines a set of interfaces, such as Connection, Statement, and ResultSet, but does not implement them. In fact, sun does not have the ability to implement it, because different DBMS have different data organization formats, and sun does not know how to connect to the database, how to execute SQL statements, and how to process returned result sets, therefore, the data access through interfaces is cleverly transferred to the database provider, so I have to say this is really brilliant.

 

 

In our system, the rational use of interface features can effectively improve the scalability and flexibility of the system, especially the emergence of Spring, through the strengthening of IOC, more prominent interface functions, it is easier for learners to understand the meaning of interfaces at the code level. The non-intrusive Design of Spring reduces the cost of component replacement and function expansion, opening another window for developers to develop programs.

 

 

Not all components in the system need to provide interfaces. When defining interfaces, you should first define the Function Extension points. For codes with fixed formats, you do not need to define interfaces. Generally, defining an interface for the business class is a good choice, and business changes are common. Providing interfaces for the business class helps us to actively adapt to business changes.

 

 

Eclipse makes "refactoring" more powerful. If your business class has no interfaces, you can use the "Refactor-> Extract Interface" menu to automatically generate corresponding business interfaces for the business class.

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.