🧀
Smells to Refactoring
English
English
  • Introduction
  • Quick Reference Guide
  • Bloaters
    • Long Method
    • Large Class
    • Primitive Obsession
    • Long Parameter List
    • Data Clumps
  • Tool Abusers
    • Repeated Conditional Complexity
    • Refused Bequest
    • Alternative Classes with Different Interfaces
    • Temporary Field
  • Change Preventers
    • Divergent Change
    • Shotgun Surgery
    • Parallel Inheritance Hierarchies
    • Combinatorial Explosion
  • Couplers
    • Feature Envy
    • Inappropriate Intimacy
    • Message Chains
    • Middle Man
    • Indecent Exposure
  • Dispensables
    • Comment
    • Data Class
    • Dead Code
    • Duplicated Code
    • Lazy Class
    • Speculative Generality
    • Oddball Solution
  • Incomplete Library Class
  • 😎About me
Powered by GitBook
On this page
  • Lazy Class
  • Speculative Generality
  • Data Class
  • Duplicated Code
  • Comment
  • Dead Code
  • Oddball Solution

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

PreviousIndecent ExposureNextComment

Last updated 1 year ago

https://refactoring.guru/refactoring/smells
https://code-smells.com/