Design patterns II - Adapter pattern

less than 1 minute read

There are 4 categories of design patterns called Gang of Four(GoF):

  • Creational patterns

  • Structural patterns

  • Behavior patterns

  • Concurrency patterns

Adapter pattern is a structural pattern.

Adapter pattern definition: Convert the interface of a class into another interface clients expect. An adapter lets classes work together that could not otherwise because of incompatible interfaces. The enterprise integration pattern equivalent is the translator.

UML:

For example, there are 2 targets that 2 different clients expects.

SUN Jiangong

SUN Jiangong

A senior .NET engineer, software craftsman. Passionate about new technologies.