I think the essence of command mode is to isolate the trigger from the receiver, to elevate a function capable to the level of the class. A base class containing virtual functions Excute () do a lot of specific receiver class C**command (), in the specific receiving class to implement Excute, And the trigger invoke contact is the base class, the use of polymorphism, the real director is the specific recipient class, so isolated, no matter how many specific recipient class, both code is not affected very flexible
| Many Linux software can support both UI operations and command letter operations. You must use the command mode. |
The command mode actually decouples the software from the real business logic and UI |
|
advanced features such as transaction rollback can also be supported after the command is instantiated The logs recorded in the SQL database are the command that is recorded. Rollback to a database transaction.
Computer software Science is to add the indirect layer to achieve abstract science.
Of course, every additional layer of indirection software will be more complex. So this is actually a degree of problem, not the more loosely coupled, the more modular things the better. See the actual problem solved. Strong-coupled code readability is the best.
|
My opinion on Command mode (behavior mode)