Skip to content

ALL-ARCH1004 · mixed_class_responsibilities

Judge whether one class owns unrelated responsibilities.

This is a contextual rule for all languages. Read its implementation.

Compare the exact class source and its independently citable method bodies. Mark it mixed only when separate method groups implement unrelated domain outcomes. Mark a facade, application service, visitor, or composition object intentional_coordinator only when its supplied source establishes that role. Otherwise use cohesive or uncertain. minimum_methods keeps classes with too little surface for a useful comparison out of this semantic pass.

Findings cite the exact class and method records that establish the responsibility groups.

Facades, application services, and composition objects may intentionally coordinate. A class below minimum_methods remains excluded unless the setting is lowered.

A class that prices orders and also renders HTML is mixed. A CheckoutService coordinating a pricing collaborator and a payment collaborator is an intentional_coordinator. A class whose methods all read one cluster of state is cohesive.

  • Adapts Pylint R0902 too-many-instance-attributes
  • Cites “Agile Software Development”, single responsibility principle
  • Cites “A Philosophy of Software Design”, chapter 10