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 Parent Index
Sibling aspects Formatting Metadata Redundancy Security Spelling

Smell

Symptom in a piece of code that possibly indicates a deeper problem.

Smells are certain structures in a code that indicate violation of fundamental design principles. They are usually not bugs; they are not technically incorrect and do not currently prevent the program from functioning.

Subaspects

Example

=begin
Example of Ruby code with data clumps and methods with too many
parameters.
=end
class Dummy
    def x(y1, y2, y3, y4, y5, y6, y7, y8, a); end
    def y(y1, y2, y3, y4, y5, y6, y7, y8); end
    def z(y1, y2, y3, y4, y5, y6, y7, y8); end
end

Importance

Even though they are not necessarily bugs, code smells increase the risk of bugs or failure in the future and may slow down development.

How to fix this

There are several refactoring techniques that can be used to deal with code smells including:

  • Composing methods
  • Moving features between objects
  • Organizing data
  • Simplifying conditional expressions
  • Simplifying method calls
  • Dealing with generalisation

See <https://sourcemaking.com/refactoring/refactorings> for more information.