What is the difference between the rule mode and the command mode?

Source: Internet
Author: User
The policy mode encapsulates easy-to-Change behaviors so that they can be replaced with each other, so that these behavior changes are independent of customers who own these behaviors.
Gof "design patterns": defines a series Algorithm, Encapsulate them one by one, and make them replace each other. This mode allows algorithms to be independent from their customer changes.

The command mode is an object behavior mode. It mainly solves the following problems: During the software build process, "behavior requestor" and "behavior implementers" usually present a "tightly coupled" problem.
Gof "Design Pattern" states: encapsulate a request as an object so that you can parameterize the customer with different requests; queue requests or record request logs, and supports unrecoverable operations.

 

In my opinion, one of the biggest differences between the rule mode and the command mode is that the rule mode often deals with one problem domain. That is to say, multiple policies only deal with the same problem, the command mode deals with multiple problem domains, that is, many different commands are used to do different things.

There are many similarities between various design patterns, but the focus is different.

From: http://topic.csdn.net/u/20081115/11/dbb6cb72-db92-4569-9cbd-d146d2f3bf74.html

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.