Design patterns for reading notes-adapters and appearance modes

Source: Internet
Author: User

Structural type: Adapter and facade (adapter and appearance mode)

Generally as a reading material, first of all want to clear is I now understand the design pattern of the original intention, that is, to solve what problem.

Adapter, if you have bought a port version of the iphone in the mainland to use people should have a triangle plug must be connected to a converter to use the general socket, of course, this is only a more intuitive feeling. In fact, we usually use the mobile phone charger is the adapter, imagine if we do not have this charger, how can we use ordinary sockets to charge mobile phone?

The definition of an adapter: Convert the interface you have at hand into the interface we need (business scenario: often used to fit the old program or to connect 2 sets of systems, when you can't make your docking system changes, we often need to do our own adaptation. )

The structure of the adapter:

    Target Object-target

    -adapted by the appropriate ligand

    Adapter-adapter

Demo

Ready to go to work, after work to continue to organize ~

    

Design patterns for reading notes-adapters and appearance modes

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.