Dimit France (LAW of DEMETER, LOD)

xiaoxiao2021-03-06  42

Dimit Block is called the least knowledge principle, saying that an object should have as little as possible for other objects.

The disadvantage of narrow DiMite France:

A large number of small methods in the system, these methods are merely transmitting indirect calls, unrelated to the business logic of the system.

Following the DiMitefix between the class will be a local design simplification because each part is not directly associated with a remote object. However, this will also cause the communication efficiency between the different modules of the system to decrease, and it will not make it easy to coordinate between different modules of the system.

The facade model and the mediation mode are actually the application of the Dimit Block.

The broad design of Dimitzi is reflected in the design of the thunder:

Priority is given to set a class into constant classes.

Try to reduce access to a class.

Care uses Serializable.

Try to reduce the access rights of members.

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

New Post(0)