A. I understand the full structure of MVC (no description of view)
1.Action with
Combination Mode, which can represent a simple action or a set of action combinations.
List<action> cmd represents the task to be performed and can be disassembled into one or a set of actions (action).
Take database operations as an example:
1.1 Execute a simple insert command, just create an insert action;
1.2 To implement a complex
Transactions(a group of additions and deletions to the operation), you can add these additions and deletions action to create a composite action;
1.3 To implement multiple unrelated commands, you can provide a set of actions;
1.4 To implement a simple search, simply create a query action;
1.5 to implement a cascading query, you need to create a composite query action, that is, the parent query action to add a cascade of the sub-search action, combined into a composite query action.
PS: If the business logic is very simple, control can call DAO directly;
2.list<action>
Undo and RedoTo implement undo (undo) and Redo (redo), and the implementation requires action mates.
3.Action Perform tasks with
Command mode, the real execution is performed on the Idao object (the command is separated from the implementation, easy to expand), and the Idao object uses
Abstract Factory modeCreate.
4.ConcreteDao implementation of Idao interface, focus on adding and deleting the logical implementation of the search, the implementation of the concrete implemented by DBHelper. Advantages: 1. Action can represent a lot of action, scalability is strong; 2. Use abstract Factory mode to easily convert database operations; 3.Control classes can implement redo and undo operations, and support transactions (a set of action or compound action) Cons: 1. There are multiple interfaces, the implementation is relatively complex;
B. Simple version of MVC, focusing on database operations (view not shown)
Understanding of MVC Design Patterns