Adapter

E173608

Adapter is a structural design pattern that allows incompatible interfaces to work together by converting the interface of one class into an interface expected by clients.

All labels observed (2)

Label Occurrences
Adapter pattern 3
Adapter canonical 1

How this entity was disambiguated

Statements (47)

Predicate Object
instanceOf Design pattern
Structural design pattern
applicableWhen You need to integrate classes with incompatible interfaces
You want to create a reusable class that cooperates with unrelated or unforeseen classes
You want to use an existing class but its interface does not match the one you need
belongsTo Gang of Four design patterns
category Structural pattern
classAdapterUses Multiple inheritance
consequence Can hide or restrict some functionality of the adaptee
Can increase complexity of class structure
Introduces an extra level of indirection
definedIn Design Patterns: Elements of Reusable Object-Oriented Software
differsFrom Decorator pattern adds responsibilities, Adapter changes interface
Facade pattern simplifies a subsystem interface, Adapter converts one interface to another
exampleUseCase Adapting a legacy logging library to a new logging interface
Adapting a third-party payment gateway API to an internal payment interface
Adapting different database drivers to a common repository interface
hasAlternativeName Adapter pattern
linked to: Adapter

Wrapper
hasVariant Class adapter
Object adapter
introducedBy Erich Gamma
John Vlissides
Ralph Johnson NERFINISHED
Richard Helm
keyParticipants Adaptee
Adapter
Client
Target
linked to: Target Corporation
objectAdapterUses Object composition
operatesOn Classes
Interfaces
Objects
primaryIntent Allow classes with incompatible interfaces to work together
Convert the interface of a class into another interface clients expect
promotes Open-closed principle
Reuse of existing functionality
Single responsibility principle
publicationYear 1994
relatedTo Decorator pattern
linked to: Decorator

Facade pattern
linked to: Facade
typicalImplementationLanguage Object-oriented languages
usedFor Bridging incompatible APIs
Integrating legacy code
Migrating between different interfaces
Reusing existing classes without modifying them
Supporting third-party libraries

How these facts were elicited

Referenced by (4)

Full triples — surface form annotated when it differs from this entity's canonical label.

Adapter hasAlternativeName Adapter pattern
linked to: Adapter
Bridge relatedTo Adapter pattern
linked to: Adapter
Decorator relatedTo Adapter pattern
linked to: Adapter