2

A common use of the adapter pattern is to support functionality that isn't actually supported in an underlying class. For example, if I use an API to interact with a Samsung Smart TV, I might want to add functionality not available through the API. To do this necessitates the use of a wrapper object that interacts with the API, rather than just interact with the API itself.

This indirect use of the Samsung API suggests to me that we are now in proxy pattern territory. Am I wrong?

1 Answer 1

7

The short answer, a proxy is supposed to be transparent. It provides the same interface as the system/object it is proxying. But performs an additional task that is not part of the application logic like caching, greedy loading etc..

An adaptor implements a different interface without adding functionality. E.g. to support multiple backends for something.

TLDR proxies transparently provide access, adaptors provide compatibility. They are something different.

If you combine their functionality into a single unit one might argue that you end up with an agent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.