Dispensables

An unnecessary code that should be removed from the codebase.

A dispensable is something unnecessary that, if removed, would make the code cleaner, more efficient, and easier to understand.

This concept is easy to understand but quite important because it encourages developers like us to identify and eliminate redundant or unnecessary components in our codebase. By removing these dispensable codes, developers can improve the overall quality and maintainability of their code. Additionally, eliminating unnecessary components can also lead to better performance and reduced resource consumption.

Therefore, it is crucial for developers to regularly review their code and identify any dispensable code smells that can be refactored to enhance the code quality.

The smells in this category may vary depending on the source. In my opinion, I believe the following six smells should be included.

Lazy Class

A "Lazy Class" smell is a class that doesn't do enough meaningful work to justify its existence.

Speculative Generality

When you find codes for future requirements that are not currently needed.

Data Class

A "Data Class" that only holds data without meaningful behavior can be seen as a violation of this smell.

Duplicated Code

This smell occurs when identical or very similar code fragments appear in multiple places.

Comment

The “Comment” smell includes both excessive and redundant comments. Excessive comments can clutter the code, making it harder to read, while redundant comments state the obvious and don't provide meaningful information.

Dead Code

Dead code refers to code that is no longer executed or reachable in the current codebase.

Oddball Solution

The same problem is solved differently in different places.

Reference

https://refactoring.guru/refactoring/smells

https://code-smells.com/

Last updated