Code Smell
20 items tagged with "code-smell"
Anti-Patterns20
Boolean Trap
Function parameters that take a bare boolean force readers to decode opaque true/false call sites, hiding intent and inviting wrong arguments.
Stringly Typed Code
Using strings to represent data that has real structure or a fixed set of values, discarding type safety and pushing errors to runtime.
Primitive Obsession
Modeling domain concepts with raw primitives like int and string instead of dedicated types, scattering validation and inviting invalid data.
Magic Numbers
Unexplained numeric literals embedded in code, hiding their meaning and duplicating values that must change together.
Magic Strings
Hardcoded string literals that act as keys, flags, or identifiers, with no central definition, inviting typos and silent failures.
Long Method
A single function that does too much and runs for hundreds of lines, mixing many concerns and resisting comprehension, testing, and reuse.
Long Parameter List
A function signature with too many parameters, making calls error-prone, hard to read, and a sign of poorly grouped or missing abstractions.
Data Clumps
The same group of fields or parameters traveling together everywhere, signaling a missing abstraction that should be a single object.
Feature Envy
A method that is more interested in another class's data than its own, repeatedly reaching into that class instead of letting it own the behavior.
Exception Swallowing
Catching exceptions and then ignoring them, hiding failures so that errors pass silently and bugs become nearly impossible to diagnose.
Null Checking Everywhere
Defensive null checks scattered through the codebase to guard against nulls that could be designed away, cluttering logic and still missing cases.
Refused Bequest
A subclass that inherits methods or data it does not want or use, often overriding them to do nothing, signaling a wrong inheritance relationship.
Yo-Yo Problem
An inheritance hierarchy so deep that understanding behavior forces constant scrolling up and down between many classes to trace a single call.
Call Super
A framework requiring subclass overrides to call the parent method, a fragile contract that breaks silently whenever a developer forgets the call.
Temporal Coupling
Methods that must be called in a specific hidden order, where calling them out of sequence silently breaks state with no compiler protection.
Switch Statement Smell
Repeated switch or if-else chains branching on a type code, duplicated across the codebase, that should be replaced by polymorphism.
Poltergeist
A short-lived, do-nothing class that only passes data or calls to other objects, adding indirection and noise without real responsibility.
Sequential Coupling
A class designed so its methods must be invoked in a rigid sequence, with the ordering enforced only by convention rather than by the API itself.
Copy-Paste Programming
Duplicating blocks of code instead of factoring out shared logic, so every fix and change must be repeated across each copy, and some are missed.
Redundant Comments
Comments that merely restate what the code already says, adding noise, drifting out of date, and masking the absence of self-explanatory code.