Code Smells

Code smell /kəʊd smɛl/

noun

A characteristic of computer code that may indicate a deeper flaw.

The following code smells are from the Mäntylä-Lassenius taxonomy.

Bloaters

A Bloater smell represents a code element that has grown so large that it cannot be effectively handled.

Data Clump code smell iconData Clump Large Class code smell iconLarge Class Long Method code smell iconLong Method Long Parameter List code smell iconLong Parameter List Primitive Obsession code smell iconPrimitive Obsession

Object-Orientation Abusers

An Object-Orientation Abuser smell occurs when code does not take full advantage of object-oriented design.

Alternative Classes with Different Interfaces code smell iconAlternative Classes with Different Interfaces Refused Bequest code smell iconRefused Bequest Switch Statement code smell iconSwitch Statement Temporary Field code smell iconTemporary Field

Change Preventers

Change Preventer smells inhibit future development and modification of code.

Divergent Change code smell iconDivergent Change Parallel Inheritance Hierarchies code smell iconParallel Inheritance Hierarchies Shotgun Surgery code smell iconShotgun Surgery

Dispensables

Dispensable smells are unnecessary code that causes clutter in your codebase.

Data Class code smell iconData Class Dead Code code smell iconDead Code Duplicate Code code smell iconDuplicate Code Lazy Class code smell iconLazy Class Speculative Generality code smell iconSpeculative Generality

Couplers

A Coupler smell represents high degrees of dependency between different parts of the codebase.

Feature Envy code smell iconFeature Envy Inappropriate Intimacy code smell iconInappropriate Intimacy Message Chain code smell iconMessage Chain Middle Man code smell iconMiddle Man

Books about code smells

Learn to write better smelling code.

Refactoring: Improving the Design of Existing Code book cover

Refactoring: Improving the Design of Existing Code

Code smells: A Predictor of Remarkable Quality Improvement book cover

Code smells: A Predictor of Remarkable Quality Improvement

Clean Code: A Handbook of Agile Software Craftsmanship book cover

Clean Code: A Handbook of Agile Software Craftsmanship

I receive a commission on sales made from the above affiliate links.