In this section we would take a look at oddball solution code smell. So what is a odd ball solution, if one problem is solved in one way throughout a system and the same problem is solved in another way in the same system in some cases, one of the solutions is oddball solution.
This particular smell is also known as Inconsistent Solution.
This happens specially in case of algorithms, different algorithm or different version of the same algorithm is been used several places which creates inconsistency and duplicate code.
How odd ball solution get in to the system?
There are two obvious reason for this,
- Ignorance of how a solution is implemented elsewhere in a system.
- Not spending enough time refactoring code to use a consistent solution.
How to get rid of odd ball solution?
The Simple process to get rid of oddball solution is to use extract method and use same method and use same algorithm all over the system.
While picking the right solutions for a problem we must consider which solution is been used majority of time then decide if this solution is better than the one is been used minority times. Compare and then keep the best one and eliminate the other one.