Design Model: intermediary model learning and understanding, design model intermediary Model

Source: Internet
Author: User

Design Model: intermediary model learning and understanding, design model intermediary Model

Mediator Pattern is used to reduce the complexity of communication between multiple objects and classes. This mode provides an intermediary class that usually processes communication between different classes and supports loose coupling to make the code easy to maintain. The intermediary mode is a behavior mode.

Intent:An intermediary object is used to encapsulate a series of object interactions. The intermediary makes the objects do not need to be explicitly referenced to each other, so that the coupling is loose and the interaction between them can be changed independently.

Main solution:There are a lot of associations between objects, which will inevitably lead to complicated system structure. At the same time, if an object changes, we also need to track associated objects, make corresponding processing at the same time.

When to use:Multiple classes are coupled to form a mesh structure.

 

Solution:Separate the preceding mesh into a star structure.

In the past few days, our company has a project involving this part. The municipal special equipment inspection agencies have their own inspectors. However, due to various reasons, there are often insufficient inspectors in some cities, at this time, you can borrow from other cities, but this loan has a fixed object and scope.

Suppose in Henan province, if there are fewer than 225 inspectors in Anyang, they can be transferred from Jiaozuo. If there are fewer than 215 inspectors in Luoyang, they can be transferred from Anyang. If there are fewer than 235 inspectors in Jiaozuo, they can be transferred from Luoyang, this is just a simulation requirement. Do not take it seriously...

Related Article

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.