What are the differences between proxy, wrapper or a façade classes

前端 未结 3 1223
野的像风
野的像风 2021-01-30 03:05

What are the differences between proxy, wrapper or a façade classes

They all seem to be the same to me, they take an implementation, encapsulate it and then methods are

3条回答
  •  既然无缘
    2021-01-30 03:51

    Many design patterns have the same structure, as you have seen.

    The difference is in the reason for their existence - the why of their existence.

    A proxy is there to act as a local object representing a remote one.

    A wrapper is there to wrap an existing object to extend/change its behavior.

    A façade exists to simplify a complex API and expose a simple one instead.

提交回复
热议问题