What is the difference between the Facade and Adapter Pattern?

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

    Facade

    Abstracts complexity to provide a simpler interface. Say for example, an computer OS abstracts the complexity of underlying hardware. Or a high-level programing languages(Python/JavaScript) abstracts complexity when compared to a low-level language(C).

    Adapter

    It's analogues to a hardware adapters. Say you want to connect a USB device to a serial port, you will need a USB-serial port adapter.

提交回复
热议问题