Applied Adapter Design Pattern

Design patterns in software are pretty often explained in a boring dry language that works as a sleeping pill (yes, I’m talking about that white book). The Head First Design Patterns tries to make the process of learning designer pattern funner, but IMO the Head First books you can’t see the forest for the trees. Future technical books should be short, fun to read, and up to the point. In today’s world Wikipedia often gives you a decent answer in a street language without too many words. For example, here’s how Wikipedia defines the Adapter:

The adapter pattern is a design pattern that translates one interface for a class into a compatible interface. An adapter allows classes to work together that normally could not because of incompatible interfaces, by providing its interface to clients while using the original interface.

While teaching object-oriented programming, I tell my students that objects in programming represent objects from the real world. One of the examples is an adapter for a traveler.

Recently, I ran into another real-world example of the Adapter pattern, which may resonate well with my students. I’m talking about bras. Take a typical situation, your girlfriend wears large cup sizes, but if one manufacturer labels them as 36DD, the other calls them 36G or even 36FF (devaluation in action).

This is where the Adapter would help. Software developers at applied this pattern (they called it Universal Cup Sizing).
bra And now, when you’ll be shopping for the gift for the upcoming Mother’s Day, just visit this site, enter the size and brand of one of her existing undergarments and get the universal cup size. Shopping for bras was never that easy, thanks to the Adapter pattern!

Offtopic. Twenty years ago, when I arrived to the USA and went to a large home improvement and construction store asking for bra, they were surprised and tried to politely direct me to a different store. The thing is that bra in Russian means a lamp hanging on the wall (see

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s