Code Smells

Code smell /kəʊd smɛl/

noun

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

Code smells are surface-level indicators of deeper programming design flaws. 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 icon Data Clump Large Class code smell icon Large Class Long Method code smell icon Long Method Long Parameter List code smell icon Long Parameter List Primitive Obsession code smell icon Primitive 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 icon Alternative Classes with Different Interfaces Refused Bequest code smell icon Refused Bequest Switch Statement code smell icon Switch Statement Temporary Field code smell icon Temporary Field

Change Preventers

Change Preventer smells inhibit future development and modification of code.

Divergent Change code smell icon Divergent Change Parallel Inheritance Hierarchies code smell icon Parallel Inheritance Hierarchies Shotgun Surgery code smell icon Shotgun Surgery

Dispensables

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

Data Class code smell icon Data Class Dead Code code smell icon Dead Code Duplicate Code code smell icon Duplicate Code Lazy Class code smell icon Lazy Class Speculative Generality code smell icon Speculative Generality

Couplers

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

Feature Envy code smell icon Feature Envy Inappropriate Intimacy code smell icon Inappropriate Intimacy Message Chain code smell icon Message Chain Middle Man code smell icon Middle 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.