Skip to main content
PProfileMatch
← Path

Design Patterns · Structural Design Patterns: Adapter, Decorator and Facade in Java

0 XP
  1. 1 current stop: learning
  2. 2 upcoming
  3. 3 upcoming
  4. 4 upcoming
  5. 5 upcoming

Finish after stop 5

Stop 1 of 5 · Airport arrivals: socket shapes

Trick to keep in mind+3 XP

Adapter is a travel plug. Decorator is a phone case. Facade is the reception desk.

All three wrap something, so judge them by intent. An adapter makes a foreign class fit the interface your code already expects. A decorator wraps an object so that it can be used anywhere the original could, while adding behaviour, which is why decorators can be stacked. A facade offers a new, smaller front door to a whole subsystem.

Read it once, then a question tests whether the trick stuck.