Design Pattern-Eleven dumits rule-difficult to handle without acquaintances

Source: Internet
Author: User

Dumit rule)(Also known as the minimum knowledge principle) If two classes do not need to communicate with each other directly, they should not interact directly. If one class needs to call a method of another class, it can be forwarded by a third party.

The premise of the dimit rule is that in the structure design of the class, each class should minimize the access permissions of members, that is, a class should wrap its own private State, do not disclose fields or behaviors that other classes know.

IsThe loose coupling between classes is emphasized.. In program design, the weaker the coupling between classes, the more conducive to reuse. A class with weak coupling is modified and will not affect related classes. That is to say, information Hiding promotes the reuse of software.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.