Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
53 lines (37 sloc) 1.67 KB
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
You can’t perform that action at this time.