Ood---The relationship between class and object---use relationship principle

Source: Internet
Author: User

4.1 Minimize the number of classes of collaboration, that is, reduce the number of users and users.

Collaboration implies a degree of coupling, but classes that are completely non-cooperative are meaningless and can be used at most as a library.

By abstracting, relying on interfaces, you can minimize the dependency of the implementation class, for the consumer, only see the interface dependencies, and the specific implementation of the dependency can be post-late binding to configure the dependency.

e.g. Menu----beef

----Lamb

----) chicken can be abstracted as

Menu----> Meat <=== Beef

<=== Lamb

<=== Chicken

where----> representative use, <==== represents the implementation

4.2 Minimize the number of messages that are passed between classes and collaborators.

4.3 Minimizing the amount of collaboration between classes and collaborators

That is, reduce the number of different messages that are passed between classes and collaborators.

4.4 Minimize fan-out of the class.

The number of messages (methods) of the class X messages sent (methods that call other classes) = The fanout of the class.

Ood---The relationship between class and object---use relationship principle

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.