Oodp: Adapter

Source: Internet
Author: User

The adapter accepts one type and generates an interface for other types. Adapter is a type of packaging for the original interface, that is, wrapper.

It is a dual mode, with two types of schema and schema object. See the following illustration in two cases.

The adapter mode is mainly used to solve the mismatch between two existing interfaces. It does not consider how these interfaces are implemented or how they may evolve. In this way, you do not need to redesign any of the two independently designed classes to make them work together.

One of the most common application scenarios that I think of most is packaging the third-party tool library Lib, which is easy to use in projects. Programming interfaces provided by hardware such as attendance machines, scanning guns, and computer scales.

Note the difference between facade and adapter: facade defines a new interface, while the adapter reuses an original interface to make the two existing interfaces work together.

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.