Php design mode-command mode

Source: Internet
Author: User

Command mode: encapsulate a request as an object so that you can parameterize the customer with different requests, queue requests or record request logs, and support unrecoverable operations.Command class:1. Command role: declares an abstract interface for all specific command classes. This is an abstract role. 2. Specific command role: defines the weak coupling between a receiver and behavior; implements the execute method and is responsible for calling the corresponding operations accepted. The execute () method is usually called the execution method 3. Customer role: create a specific command object and determine its recipient. 4. requester role: the requester role is responsible for calling command objects to execute requests. The related methods are called Action methods. 5. Recipient role: responsible for implementing and executing a request.Purpose:1. abstract the action to be executed to parameterize the object. 2. Specify, sort, and execute requests at different times. 3. cancelling is supported. 4. Log modification is supported.

<? ConcreteCommand _ construct (-> _ faster ER =-> _ faster er-> _ construct (-> _ name =-> _ name. 'Do action. <br/> '_ construct (-> _ command =-> _ command-> = Consumer Er ('jaky' = ConcreteeCommand (= Invoker (->::?>

 

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.