Adapter Patterns

Suppose we have two or more libraries that do more or less the same thing but cannot decide which to use. These libraries might have a similar functional interface but different performance characteristics. As an example, consider key-value stores: one store might keep keys and values in memory, and another might keep keys in memory and values on disk. Yet another might keep keys with small values in memory but store large values on disk. Even for something as simple as a key-value store there are many variations on how the store is actually implemented.

Suppose we want to write some code that makes use of a key-value store. At the time when we write our application, we have to make a design decision and choose a particular ...

Get Programming Erlang, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.