Browse Clojure Foundations for Java Developers

Composition Over Inheritance

Build systems by composing functions and data instead of relying on deep inheritance hierarchies.

Inheritance is a powerful tool in Java, but it often turns reuse into rigidity: behavior and data get coupled to class hierarchies, and change becomes expensive.

In Clojure, composition is the default: you build behavior by combining small functions and you build “models” as plain data. When you need polymorphism, you choose it explicitly (protocols, multimethods) rather than inheriting it everywhere.

This section helps you translate “OO reuse instincts” into functional composition that stays flexible under change.

In this section

Revised on Friday, April 24, 2026