Design Mode (7) the adapter and Facade Pattern adapter mode and appearance Mode

Source: Internet
Author: User
Object-oriented Adapter

Assume that a software system already exists and you want it to work with a new vendor class library, but the interfaces designed by the new vendor are different from those of the old vendor.

You don't want to change the existing code to solve this problem. You can write a class to convert the vendor interface into the interface you expect.

 

The process of using the adapter is as follows:

1. The customer sends a request to the adapter by calling the method of the adapter through the target interface.

2. the adapter uses the adapter interface to convert requests to one or more called interfaces of the adapter.

3. The customer receives the call result, but does not notice that all of this is the conversion function of the adapter.


Design Mode (7) the adapter and Facade Pattern adapter mode and appearance 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.