Menu

1 / 2

Code Smell 323 - Harness-Driven Superclass

DEV Community: tutorial·Maxi Contieri·10 days ago
#hbA0Ndwd
#devtotutorial#devto#dev#class#number
Long article (1351 words) — no AI summary yet.
Reading 0:00
15s threshold

You didn't split the class. You hid half of it upstairs

TL;DR: Don't create a superclass just to pass a size limit. Move behavior into collaborators with delegation.

Problems 😔

Inheritance without a real specialization

Hidden coupling to the superclass

Yo-yo navigation across files

Fragile base class

Vague parent names

Responsibilities stay in one object

Bijection violation

Solutions 😃

Extract cohesive collaborators

Delegate, don't inherit

Split by responsibility

Name by domain concept

Measure cohesion, not size

Refactorings ⚙️

Context 💬

A harness caps class length, property count, and method count, and it rejects code that goes over.

Some limits work as good alarms for growing responsibilities ( long functions , too many attributes , too many methods ).

You ask an AI assistant to make the failing class pass.

The shortcut path is moving half of its members into a new parent class.

The count per class drops, the check turns green, and nothing else changes.

The behavior stays in the…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.