What is a Code Smell and How to Get Rid of It?
Kent Beck invented a new term “code smell” for describing problems in an application.
This term is often used by programmers and test engineers when they discuss refactoring. Code smells are symptoms of problems in the code.
Code Smells Can Lead To:
- serious defects in a program;
- unreproducible defects that complicate functional testing, security testing, performance testing and other tests, as well as further progress of the project;
- failure of the whole system.
That is why specialists in mobile testing, desktop testing and web site testing usually insist on finding and removing code smells as early as possible.
Refactoring is meant to eliminate code smells. But first of all one should find them in the system. There are some tools that help to determine code smells, but it isn’t wise to fully rely on any tool in this case. The best way to locate code smells is to use experience and intuition of the programmers.
The thing is that there are no distinct descriptions of code smells, though one can find lists where problem places that have to be reviewed are described. But such places don’t necessarily mean that there are defects in the code.
Experts in automated testing know that code smells are characteristic for automated tests as well. So, automated tests require refactoring as any application. Otherwise they will not provide reliable test results.