Understanding of MVC Design Patterns

Source: Internet
Author: User

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

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.