IT lexicon › Programming › Adapter pattern

Adapter pattern

Programming På svenska → Updated: 2026-05-23

Gang-of-Four structural pattern — wrap a class so its interface looks like another. "Pipe-to-pipe adapter".

Two flavours: object adapter (composition — the adapter owns an instance of the adapted) and class adapter (multiple inheritance, rare). Classic use cases: legacy APIs against modern signatures, third-party libraries against your domain model.

Sweet spot: bridging code you don't own with code you design. Resembles Facade (Facade simplifies, Adapter translates).

← Back to the lexicon