Skip to content

Interface anti-patterns

Interfaces can become extremely powerful, but only if they remain semantically coherent.

Anti-patterns

Anti-patternWhy it hurtsBetter alternative
giant catch-all interfacesdestroys reuse claritymake interfaces narrowly purposeful
interfaces that duplicate one object type exactlyadds indirection with no reusekeep logic on the object type unless reuse is real
using interfaces as loose tags onlymisses semantic structuregive interfaces explicit properties and meaning
attaching too many unrelated interfacescreates semantic confusioncompose only when behaviors truly align

Design rule

An interface should describe a reusable operational trait, not an arbitrary bucket of fields.

Released under the Apache 2.0 License.