Lesson
Vocabulary: Adapter
Vocabulary after construction: Adapter
The previous exercise began with Expected Behavior and design pressure, not with this name.
The structure that emerged is traditionally called Adapter.
What the reasoning established
- Stable role: Application code wants a pay(order_id, cents) payment capability.
- Change pressure: Vendor APIs can differ from the application contract.
- Ownership/lifetime when relevant: The gateway is constructed externally and owned by the adapter or root.
- Structural consequence: A boundary object wraps the incompatible gateway.
- Runtime topology: Translate request → call gateway → translate status/result.
Nearby distinction
Facade: Adapter changes the contract seen by the caller; Facade simplifies access to a subsystem without translating its meaning.
Simplify
Ask whether any abstraction can be removed while preserving the original acceptance behavior and design-stress property. If yes, prefer the simpler design.
Use the pattern name to communicate a structure you can already justify. Do not use the name as a recipe that replaces requirements analysis.
Sign in with an enabled provider to save your lesson progress.
Sign in to track progress
Loading sign-in options…