Java service domain DAO layered thinking

Source: Internet
Author: User

From the most general hierarchy, the system hierarchy is from top to bottom:

Presentation layer: The main client display.

Service layer: A service or function that is directly provided to the client. It is also the function that the system can provide externally.

Domain layer: Domain activities within the system.

DAO Layer: A data access object that operates a database through a domain entity object.

Some of the Guiding principles are:

1, the upper layer always relies on its lower level, the dependency relationship does not cross the layer.

2, except for the expression, the same layer of the method is not allowed to call each other. This is the actual development of some developers easy to fan the error! If you really have a method call between the same layers, be aware that these are some of the upper-level invisible methods, such as some tool methods.

3, everything from the service layer, from the system needs to provide the functions of analysis, determine the service interface method. Instead of starting from a database table, creating DAO, recreating domain, and then service, this is actually a misunderstanding of system layering.

4. The core design of the system is to classify the entities in the system into domain models. Based on this, the DAO layer of data is designed and exposed to the service layer, and the implementation of the service layer depends on the domain activity.

5. The scope of responsibility of each interface is clear and bounded.

File name:

Action (Presentation layer)

Domain (Domain level)

Service (services Tier)

Persistence (persistent layer, DAO layer)

Util (save some common tool classes)

Java service domain DAO layered thinking

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.