Demeter - design principles in life

r If there really is some of the principles, these principles will be applied in our subconscious life,

  Demeter, the principle of a minimum of knowledge.

 Suppose you day one, you just know that IT departments need to help you install your computer, then the original task gave Zhang sector, but because of production bug, Zhang went to see, he can put the task to please Xiaoming, that so for you, department or help you complete the entry.

But if you know too much, you know your interviewer Xiao Zhang, Xiao Zhang then please direct me to deal with this matter, then Zhang to regulate the production bug, you may not be able to complete the task, because you put the task to to a specific person's body, rather than a part, certainly I do not want other people to help you do this one thing friends. So your task will be subject to specific impact.

  Suppose you know very little, you can put the task ping times to the department, and department changes, it will not affect you, at least the principle of knowledge.

      If you can introduce a third party, the coupling will be lower, rather, to call in some way between the service of sending mq

  Demeter, if the two classes do not have to communicate with each other, then the two classes should not direct interaction occurs, wherein if a class needs to call a method of a class, it can be conveyed through the third discharge.

 

Guess you like

Origin www.cnblogs.com/wangchaodong/p/12002372.html