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