Handle the amount of offline computation in bridging mode

Source: Internet
Author: User

Handle the amount of offline computation in bridging mode


The last personal version, the money on and off the machine is part of the strategy + responsibility chain, (for details, see: http://blog.csdn.net/lhc1105/article/details/30713331) and then because the call method is too much, added a look, the processing is a bit complicated, and it seems that the mode is a little stiff.


This cooperative edition removes the design pattern and uses another design pattern to process it.

This time, the bridge mode is used:




Because the downtime is affected by the calculation of money to two parameters, one is the user type and the other is the charging policy, the two changes are separated in the bridging mode, it is easier to expand and cope with changes than to write N * M policies in the past. You can add many types of users or write many billing methods, if there are many sub-classes in both directions, the N * M combination will be very large. This structure is a dynamic generation strategy compared with the main policy mode, it is more flexible than writing all policies in advance.


Conclusion: The design pattern is quite interesting. When you use the Personal Edition, you can add it. When you get to the partner edition, You can rethink your own pattern to optimize it.





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.