How to prevent Service layers from calling each other and Service layers from calling other Dao layers

there are several problems in the process of learning architecture:

  1. some Service layers will call other Dao layers, for example, UserService will call UserPositionDao
    UserBookDao
  2. some Service layers will call other Service layers, for example, UserService will call UserAppleService
    UserPencilService
  3. Department Controller layer calls multiple Service layers

according to the idea of hierarchical design, this kind of design is unreasonable. A great god said to use Facade layering to avoid it, so I changed it to

.
  1. A Service can only call one Dao, and cannot exchange Service with each other
  2. A Facade can call different Service
  3. A Controller can only call one Facade, and cannot call Service

here comes the question of whether all the methods I wrote in UserService have to be implemented again in UserFacade, otherwise Controller will not be able to penetrate Facade to use Service methods.

unless Facade is equal to Service, Facade is only a special Service, and Controller can only call its own Facade and Service. at most

.

is that so?


according to the idea of hierarchical design. This is unreasonable. But now it's all about service-oriented programming (SOA). It is inevitable that your service invokes other services. You can use rpc frameworks such as dubbo to call other service remotely. To reduce the coupling.

clipboard.png
system architecture evolves in the same way


what's wrong with


Service calling other ORM layers? what's the point of not layering? just get rid of Service


General springmvc architecture design call specification
Controller calls the Service layer is: one-to-one interface calls, and the Controller layer does not do any business processing. The purpose is to prepare the
Service layer to avoid calling each other in order to further expand and directly replace Controller for the RPC framework. In general, things are configured in the service layer. In order to avoid problems such as nesting of things or excessive size of a single thing, the
service layer calls the Dao layer: in addition to controlling the size of things as far as possible, that is, controlling the complexity of the Service calling dao layer, controlling the volume of a single thing within the 100ms

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34fb1-4d5f6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34fb1-4d5f6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?