cover-img

How to Find the Stinky parts of your Code

12 November, 2022

21

21

0


TL;DR: A Compilation of bad smells in code.

The code smells badly.

Let's see how to change the aromas.

In this series, we will see several symptoms and situations that make us doubt the quality of our development. We will present possible solutions.

Most of these smells are just hints of something that might be wrong. They are not rigid rules.

Code Smells

Code Smell 01 - Anemic Models

Code Smell 02 - Constants and Magic Numbers

Code Smell 03 - Functions Are Too Long

Code Smell 04 - String Abusers

Code Smell 05 - Comment Abusers

Code Smell 06 - Too Clever Programmer

Code Smell 07 - Boolean Variables

Code Smell 08 - Long Chains Of Collaborations

Code Smell 09 - Dead Code

Code Smell 10 - Too Many Arguments

Code Smell 11 - Subclassification for Code Reuse

Code Smell 12 - Null

Code Smell 13 - Empty Constructors

Code Smell 14 - God Objects

Code Smell 15 - Missed Preconditions

Code Smell 16 - Ripple Effect

Code Smell 17 - Global Functions

Code Smell 18 - Static Functions

Code Smell 19 - Optional Arguments

Code Smell 20 - Premature Optimization

Code Smell 21 - Anonymous Functions Abusers

Code Smell 22 - Helpers

Code Smell 23 - Instance Type Checking

Code Smell 24 - Boolean Coercions

Code Smell 25 - Pattern Abusers

Code Smell 26 - Exceptions Polluting

Code Smell 27 - Associative Arrays

Code Smell 28 - Setters

Code Smell 29 - Settings - Configs

Code Smell 30 - Mocking Business

Code Smell 31 - Accidental Methods on Business Objects

Code Smell 32 - Singletons

Code Smell 33 - Abbreviations

Code Smell 34 - Too Many Attributes

Code Smell 35 - State as Properties

Code Smell 36 - Switch/case/elseif/else/if statements

Code Smell 37 - Protected Attributes

Code Smell 38 - Abstract Names

Code Smell 39 - new Date()

Code Smell 40 - DTOs

Code Smell 41 - Regular Expression Abusers

Code Smell 42 - Warnings/Strict Mode Off

Code Smell 43 - Concrete Classes Subclassified

Code Smell 44 - Magic Corrections

Code Smell 45 - Not Polymorphic

Code Smell 46 - Repeated Code

Code Smell 47 - Diagrams

Code Smell 48 - Code Without Standards

Code Smell 49 - Caches

Code Smell 50 - Object Keys

Code Smell 51 - Double Negatives

Code Smell 52 - Fragile Tests

Code Smell 53 - Explicit Iteration

Code Smell 54 - Anchor Boats

Code Smell 55 - Object Orgy

Code Smell 56 - Preprocessors

Code Smell 57 - Versioned Functions

Code Smell 58 - Yo-yo Problem

Code Smell 59 - Basic / Do Functions

Code Smell 60 - Global Classes

Code Smell 61 - Coupling to Classes

Code Smell 62 - Flag Variables

Code Smell 63 - Feature Envy

Code Smell 64 - Inappropriate Intimacy

Code Smell 65 - Variables Named after Types

Code Smell 66 - Shotgun Surgery

Code Smell 67 - Middle Man

Code Smell 68 - Getters

Code Smell 69 - Big Bang (JavaScript Ridiculous Castings)

Code Smell 70 - Anemic Model Generators

Code Smell 71 - Magic Floats Disguised as Decimals

Code Smell 72 - Return Codes

Code Smell 73 - Exceptions for Expected Cases

Code Smell 74 - Empty Lines

Code Smell 75 - Comments Inside a Method

Code Smell 76 - Generic Assertions

Code Smell 77 - Timestamps

Code Smell 78 - Callback Hell

Code Smell 79 - TheResult

Code Smell 80 - Nested Try/Catch

Code Smell 81 - Result

Code Smell 82 - Tests Violating Encapsulation

Code Smell 83 - Variables Reassignment

Code Smell 84 - Max < Min (Javascript)

Code Smell 85 - And Functions

Code Smell 86 - Mutable Const Arrays

Code Smell 87 - Inconsistent Parameters Sorting

Code Smell 88 - Lazy Initialization

Code Smell 89 - Math Feature Envy

Code Smell 90 - Implementative Callback Events

Code Smell 91 - Test Asserts without Description

Code Smell 92 - Isolated Subclasses Names

Code Smell 93 - Send me Anything

Code Smell 94 - Too Many imports

Code Smell 95 - Premature Classification

Code Smell 96 - My Objects

Code Smell 97 - Error Messages Without Empathy

Code Smell 98 - Speling Mistakes

Code Smell 99 - First Second

Code Smell 100 - GoTo

Code Smell 101 - Comparison Against Booleans

Code Smell 102 - Arrow Code

Code Smell 103 - Double Encapsulation

Code Smell 104 - Assert True

Code Smell 105 - Comedian Methods

Code Smell 106 - Production Dependent Code

Code Smell 107 - Variables Reuse

Code Smell 108 - Float Assertions

Code Smell 109 - Automatic Properties

Code Smell 110 - Switches With Defaults

Code Smell 111 - Modifying Collections While Traversing

Code Smell 112 - Testing Private Methods

Code Smell 113 - Data Naming

Code Smell 114 - Empty Class

Code Smell 115 - Return True

Code Smell 116 - Variables Declared With 'var'

Code Smell 117 - Unrealistic Data

Code Smell 118 - Return False

Code Smell 119 - Stairs Code

Code Smell 120 - Sequential IDs

Code Smell 121 - String Validations

Code Smell 122 - Primitive Obsession

Code Smell 123 - Mixed 'What' and 'How'

Code Smell 124 - Divergent Change

Code Smell 125 - 'IS-A' Relationship

Code Smell 126 - Fake Null Object

Code Smell 127 - Mutable Constants

Code Smell 128 - Non English Coding

Code Smell 129 - Structural Optimizations

Code Smell 130 - AddressImpl

Code Smell 131 - Zero Argument Constructor

Code Smell 132 - Exception Try Too Broad

Code Smell 133 - Hardcoded IF Conditions

Code Smell 134 - Specialized Business Collections

Code Smell 135 - Interfaces With just One Realization

Code Smell 136 - Classes With just One Subclass

Code Smell 137 - Inheritance Tree Too Deep

Code Smell 138 - Packages Dependency

Code Smell 139 - Business Code in the User Interface

Code Smell 140 - Short Circuit Evaluation

Code Smell 141 - IEngine , AVehicle, ImplCar

Code Smell 142 - Queries in Constructors

Code Smell 143 - Data Clumps

Code Smell 144 - Fungible Objects

Code Smell 145 - Short Circuit Hack

Code Smell 146 - Getter Comments

Code Smell 147 - Too Many Methods

Code Smell 148 - ToDos

Code Smell 149 - Optional Chaining

Code Smell 150 - Equal Comparison

Code Smell 151 - Commented Code

Code Smell 152 - Logical Comment

Code Smell 153 - Too Long Names

Code Smell 154 - Too Many Variables

Code Smell 155 - Multiple Promises

Code Smell 156 - Implicit Else

Code Smell 157 - Balance at 0

Code Smell 158 - Variables not Variable

CoDe SmElL 159 - mIxEd_cASe

Code Smell 160 - Invalid Id = 9999

Code Smell 161 - Abstract/Final/Undefined Classes

Code Smell 162 - Too Many Parentheses

Code Smell 163 - Collection in Name

Code Smell 164 - Mixed Indentations

Code Smell 165 - Empty Exception Blocks

Code Smell 166 - Low-Level Errors on User Interface

Code Smell 167 - Hashing Comparison

Code Smell 168 - Undocumented Decisions

Code Smell 169 - Glued Methods

Code Smell 170 - Refactor with Functional Changes

Code Smell 171 - Plural Classes

Code Smell 172 - Default Argument Values Not Last

Code Smell 173 - Broken Windows

Code Smell 174 - Class Name in Attributes

Code Smell 175 - Changes Without Coverage

Code Smell 176 - Changes in Essence

Code Smell 177 - Missing Small Objects

Code Smell 178 - Subsets Violation

Code Smell 179 - Known Bugs

Code Smell 180 - BitWise Optimizations

Code Smell 181 - Nested Classes

Code Smell 182 - Over Generalization

Code Smell 183 - Obsolete Comments

Code Smell 184 - Exception Arrow Code

Code Smell 185 - Evil Regular Expressions

Code Smell 186 - Hardcoded Business Conditions

Code Smell 187 - If/Else Backwards

Code Smell 188 - Redundant Parameter Names

Code Smell 189 - Not Sanitized Input

Code Smell 190 - Unnecessary Properties

Code Smell 191 - Misplaced Responsibility

Code Smell 192 - Optional Attributes

Code Smell 193 - Switch Instead of Formula

Code Smell 194 - Missing Interval

Code Smell 195 - Yoda Conditions

Code Smell 196 - Javascript Array Constructors

Code Smell 197 - Gratuitous Context

Code Smell 198 - Hidden Assumptions

Code Smell 199 - Gratuitous Booleans

Code Smell 200 - Poltergeist

Code Smell 201 - Nested Ternaries

Code Smell 202 - God Constant Class

Code Smell 203 - Irrelevant Test Information

Code Smell 204 - Tests Depending on Dates

Code Smell 205 - Code in Destructors

Code Smell 206 - Long Ternaries

Code Smell 207 - Dynamic Methods

Code Smell 208 - Null Island

Code Smell 209 - Side Effects

Code Smell 210 - Dynamic Properties

Code Smell 211 - Tab over Spaces

Code Smell 212 - Elvis Operator

Code Smell 213 - Hoisting

Code Smell 214 - Duplicate Parameter Names

Code Smell 215 - Deserializing Object Vulnerability

Code Smell 216 - Fat Interface

Code Smell 217 - Empty Implementation

Code Smell 218 - Magic Concatenation

Code Smell 219 - Looping from index 0

Code Smell 220 - Return Tuple

Code Smell 221 - Missing Break in Switch

Code Smell 222 - Comma Operator

Code Smell 223 - Racial Naming

Code Smell 224 - Deodorant Comments

Code Smell 225 - Pass by Reference

Code Smell 226 - Mixed Priorities

Code Smell 227 - Cowboy Coding

Code Smell 228 - Multiple Classes per File

Code Smell 229 - Red Tape

Code Smell 230 - SchrÃķdinger Code

Code Smell 231 - Redundant Data

Code Smell 232 - Reusable Code

Code Smell 233 - Collections Count

Code Smell 234 - Long Circuit

… and many more to come.

Photo by Richárd Ecsedi on Unsplash

Smells are certain structures in the code that suggest (sometimes they scream for) the possibility of refactoring

Martin Fowler

Software Engineering Great Quotes

Part of the objective of this series of articles is to generate spaces for debate and discussion on software design.

Object Design Checklist

21

21

0

Maxi Contieri

Buenos Aires, Argentina

🎓Learn something new every day.📆 💻CS software engineer 👷coding👨🏽‍🏫teaching ✍🏾writing 🎨Software Design 🏢SOLID 🌉TDD 👴Legacy 💩Code Smells

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2024. Showcase Creators Inc. All rights reserved.