CSE Roadmap

Core tier · about 3 hours · 6 parts

Part 1 of 6 · 1 min read

Why this page comes sixth

In this module you will

  • Say what the Adapter pattern does and write one around a vendor class.
  • Tell an object adapter from a class adapter.
  • Say what the Facade pattern does and write one over several services.
  • Explain how both patterns protect your code from outside change.
  • Tell Adapter, Facade and Decorator apart.

Decorator kept an interface and added behaviour. These two patterns deal with interfaces that do not fit. An adapter changes one interface into another. A facade gives a busy group of classes a single simple front. Both appear whenever a design round says "a third-party service" or "keep the API simple". The sources are "Design Patterns" (GoF) chapter 4 and "Head First Design Patterns" (HF) chapter 7. Code was compiled and run before it was written here. Numbers marked "made up" only show the idea.