Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
Root.Smell.ClassSmell Parent Index
Sibling aspects Complexity MethodSmell Naming

ClassSmell

Code smells related to classes' definition.

Class-level code smells indicate poorly defined classes (including too large classes or God object, data clump feature envy etc...) in your source code.

Subaspects

Example

class Warehouse
    def sale_price(item)
        item.price - item.rebate
    end
end

# sale_price refers to item more than self.

Importance

These classes should be refactored for better readability and maintainability of your source code.

How to fix this

When a class is wearing too many (functional) hats (too large classes), you should probably think about splitting it up:

  • Extract class
  • Extract subclass
  • Extract interface