Selection of coarse particle size and fine grainity method in the program

xiaoxiao2021-03-06  57

Why use the businessfascade layer, when you do the 5-story program, the method in the businessrule class in the code in the code is one or one. Although it is theory that businessfascade is just a proxy role, it does not experience its wonderful place, see the "distribution mode" chapter today, it is a bit suddenly open.

In an object-oriented model, there are often many smaller objects, they have a smaller way. This provides a lot of opportunities to control and replace certain behaviors, and use a good naming to be more easily understood. However, this small particle size action will result in interaction between a large number of objects, and these interactions usually require a lot of ways to call.

In a single address space, the interaction of the small particle size is very good, but when you modify between the two processes, this good state does not exist. The overhead of the remote call is very large. Any object may be used as a remote object, often requires a coarse-grained interface to reduce the number of calls needed to complete some tasks.

[Gang of Four] proposes the concept of a remote appearance, which is a thick-grained look. All fine-grained objects do not have a remote interface, and remote appearance does not contain domain logic. The job to be completed in the remote appearance is to convert the fine particle size to the low-level fine-grained method. If the example corresponding to Microsoft Duwamish is the businesssystem layer, or called the businessfascade layer.

The design of remote appearance is based on a particular customer's needs, and most of the needs are want to view and update information through the user interface. The design purpose of the appearance is to simplify the use of external users, not to simplify internal logic.

The remote appearance has a state and state of stateless. The stateless remote appearance can make a pool, which can improve the utilization and efficiency of resources, especially in B.

2C

in the case of. When using a stateful remote appearance, the remote appearance must maintain each state, which can be done by using the client session state, database session status, or server session status. If you use server session status, it may cause performance issues, especially when there are thousands of users accesses.

2 benefits from the remote appearance:

1, can increase security check

2. Provide transaction control.

For remote appearance, the biggest error is to put domain logic in it, "remote appearance does not have any field logic"

转载请注明原文地址:https://www.9cbs.com/read-114682.html

New Post(0)