What is the difference between the Facade and Adapter Pattern?

后端 未结 16 915
孤城傲影
孤城傲影 2021-01-29 23:50

I\'ve been reading both definitions and they seem quite the same. Could anyone point out what are their differences?

Thanks

16条回答
  •  鱼传尺愫
    2021-01-30 00:37

    Facade is usually contrasted with Adapter.

    +--------------------------------------------------------------+-----------------------------------------------+
    |                            Facade                            |                    Adapter                    |
    +--------------------------------------------------------------+-----------------------------------------------+
    | Simplifies multiple complex components with single interface | Provides differnet interface for an interface |
    | Works with multiple components                               | Works with single component                   |
    | Control panel is an example                                  | A power adapter is an example                 |
    | High-level interface                                         | Low-level interface                           |
    +--------------------------------------------------------------+-----------------------------------------------+
    

提交回复
热议问题