$linuxjunkies
>

adapter pattern

also: wrapper pattern, translator pattern

A software design pattern that allows incompatible interfaces to work together by creating an intermediate object that converts one interface to another.

The adapter pattern is a structural design pattern used in software architecture to bridge incompatibilities between two interfaces. It acts as a translator or wrapper that converts calls from one interface into calls compatible with another, without modifying the original code.

In Linux contexts, this pattern appears frequently in device drivers and hardware abstraction layers. For example, a USB device driver might use an adapter to convert the generic USB interface into specific protocol commands for a particular device, allowing the kernel to treat vastly different hardware through a unified interface.

Common real-world Linux examples include: network protocol adapters that convert between OSI layers, filesystem adapters that allow different filesystems to work with the VFS (Virtual File System), and device class adapters that present heterogeneous hardware through standardized device node interfaces.

Related terms