What is the difference between the Facade and Adapter Pattern?

后端 未结 16 1074
孤城傲影
孤城傲影 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:30

    As usual, there exist similarities between several patterns. But I would see it like this:

    • A facade is used to encapsulate an entire layer, and offer some methods to access it "conveniently"
    • An adapter is used, where you have two components that should already work together, but don't, only because of some "unimportant" differences in the interface.

提交回复
热议问题