You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.7 KiB

# Code Smell Patterns
**Code Smells** are often signs that refactoring could be needed. That is not always the case, but these "smells" should be looked at further to determine if there is a need for refactoring.
[Duplicated Code](./Duplicated_Code.md)
[Excessive Conditionals](./Excessive_Conditionals.md)
[Reocurring Parameter lists](./Reocurring_Parameter_Lists.md)
**Big Objects**
* Force: Refactoring may be considered if an object has many methods and variables.
* Solution: It may be possible to break this object up into a few smaller objects. This can be done for readability, simplicity, and overall funtionality.
**Big Methods**
* Force: Refactoring may be possible when a method is getting too large. (over 7 lines of active code)
* Solution: It may be possible to break this method up into smaller methods. Methods shoudl have a clear purpose and should not take on work it does not have to.
**Magic Numbers**
* Force: Refactoring may be possible when it is noticed that there are many hard-coded values and and seemingly random literals scattered throughout the code.
* Solution: It may be possible to give these vauge "magic numbers" variable names to make the code easier to read, understand, test, and maintain.
**Feature Envy**
* Force: Refactoring may be possible when it is noticed that a certian object seems to have significantly more features than other objects it is interacting with.
* Solution: It may be possible to had work off to some of these smaller objects. If the original object is reaching out to grab things that are much easier access and handled by the secondary object, than a consideration should be made to give that work to the secondary object.