Java Command mode

Source: Internet
Author: User

Real life often examples, such as the bank, in the early years, to the bank to handle business, a bunch of people around the lobby manager asked, what business should go where to handle, hey .... , a problem one day to keep up with the Lushu people explain again, hello, this business, you can go to XX counter Consulting, that this business, you can go to XY counter consulting, sometimes, may appear error, return back and forth to ask several times, good annoying oh .... , the manager is how helpless, but in order to the principle of customer first, always smile, smile. When is the day of liberation? Haha, with the development of science and technology, managers at last from the suffering of the days of liberation, that is the business processing area to take the number machine, now simple operation can be patient waiting for processing, both convenient customers, also freed the manager, is a good thing for the benefit of the public. According to the different business, the system is automatically distributed to the respective salesman where, according to the number at once processing. On the other hand, the above example on the real portrayal of the command mode, business to take the number machine, the customer's request for business, unified acceptance, classification processing, for different business, arranged to different salesman hands to deal with, avoid the tedious process.

Definition of the command pattern: encapsulate a request as an object, thereby letting parameterize clients with different requests, queue or log Requests, and support undoable operations. (Encapsulating a request as an object, allowing you to parameterize the client with different requests, queue requests or log request logs, provide undo and redo of the command), and, plainly, encapsulate the request as an object to unify the response to different requests.

General plot of the command pattern:

Key words to explain the above diagram:

Java Command mode

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.