Reinterpret familiar Java design patterns as smaller Clojure constructs: functions, data, maps of handlers, protocols, middleware, multimethods, and explicit composition.
Patterns still matter after you move to Clojure; what changes is the implementation shape. Many GoF patterns become a few lines of code once you have first-class functions and immutable data.
This section shows how to translate intent: Strategy becomes passing a function, Decorator becomes function wrapping/middleware, Builder becomes assembling a map, and Factory often becomes data-driven construction.
| Java pattern intent | Clojure expression |
|---|---|
| Select an algorithm | Pass a function, choose from a map of functions, or use a protocol when a stable contract matters. |
| Add behavior around a call | Compose middleware or higher-order functions. |
| Build a complex object | Build data through small functions and validate before crossing a boundary. |
| Create variants | Use data-driven construction, multimethods, or protocols instead of broad factory hierarchies. |