Objective:
As we all know, the most in project development is nothing more than adding and deleting (CRUD) operations. Since the development of the SSH framework, the development and development process of the domestic Web project has become more and more flexible; This paper makes a simple extraction of the business layer code in the project development for the reference of the industry friends.
The code extraction schematic diagram is as follows:
This figure mainly shows the development of 2 business, account management and category management, the specific code implementation is relatively simple not attached. From the above UML diagram we only need to abstract out the Baseservice interface and implement the Baseserviceimpl class, the implementation of the other services are inherited Baseserviceimpl and the corresponding interface can be implemented;
Some friends may wonder, why do I have to implement my own corresponding Xxservice interface after inheriting the basic Baseserviceimpl?
Imagine that our different business is not necessarily only the basic CRUD operations, or the same method name, but its own business is more special, with different parameters of business methods. Based on this, we must also realize the interface of our business.
( note : For the above UML diagram understanding barriers to friends can refer to this blog earlier about UML diagram introduction)
Classic code extraction in a Java Web project