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