architecture/composition-over-inheritance

composition over inheritance Shipped

What this lens looks for

Default to composing behaviors from small, focused pieces; use inheritance only for genuine "is-a" relationships and even then sparingly; prefer protocols/interfaces over base classes; wrap rather than subclass when extending behavior

What its verifier checks

No inheritance hierarchies more than 1 level deep except for genuine is-a relationships; shared behavior achieved via protocol/interface composition not base classes; no subclassing to extend behavior where wrapping is possible