An adapter object relies on object composition, and when we need to use several of the existing subclasses, we can use object adapter to adapt the interface of the parent class:
The preceding diagram depicts the formal structure of an Adapter.
These are the benefits:
- Saves time during development and testing by emulating a similar behavior of different parts of the application
- Provides easy extensions for new features with similar behaviors
- Allows a single adapter works with many adaptees (adapter object)
Impacts are as follows:
- Leads to needlessly duplicated codes between classes (less usage of inherited classes' functionalities)
- May lead to nested adaptions to reach for intended types that are in longer chains
- Make it more difficult to override adaptee behavior (adapter object)