Code Smells.
Indicators of deeper problems in code. Each entry links to the refactorings that treat it.
Two classes perform identical functions but have different method names.
If a subclass uses only some of the methods and properties inherited from its parents, the hierarchy is off-kilter. The unneeded methods may simply go unused or be redefined and give off exceptions.
You have a complex switch operator or sequence of if statements.
Temporary fields get their values (and thus are needed by objects) only under certain circumstances. Outside of these circumstances, they’re empty.
A method is filled with explanatory comments.
A data class refers to a class that contains only fields and crude methods for accessing them (getters and setters). These are simply containers for data used by other classes. These classes don’t contain any additional functionality and can’t independently operate on the data that they own.
A variable, parameter, field, method or class is no longer used (usually because it’s obsolete).
Two code fragments look almost identical.
Understanding and maintaining classes always costs time and money. So if a class doesn’t do enough to earn your attention, it should be deleted.
There’s an unused class, method, field or parameter.
Sometimes different parts of the code contain identical groups of variables (such as parameters for connecting to a database). These clumps should be turned into their own classes.
A class contains many fields/methods/lines of code.
A method contains too many lines of code. Generally, any method longer than ten lines should make you start asking questions.
More than three or four parameters for a method.
Use of primitives instead of small objects for simple tasks (such as currency, ranges, special strings for phone numbers, etc.)Use of constants for coding information (such as a constant USER_ADMIN_ROLE = 1 for referring to users with administrator rights.)Use of string constants as field names for use in data arrays.
You find yourself having to change many unrelated methods when you make changes to a class. For example, when adding a new product type you have to change the methods for finding, displaying, and ordering products.
Whenever you create a subclass for a class, you find yourself needing to create a subclass for another class.
Making any modifications requires that you make many small changes to many different classes.
A method accesses the data of another object more than its own data.
One class uses the internal fields and methods of another class.
In code you see a series of calls resembling $a->b()->c()->d()
If a class performs only one action, delegating work to another class, why does it exist at all?