Code Smells

Code Smells image
Code smells are warning signs in code that hint at deeper issues. Code smells aren't necessarily errors but they can make future development harder and increase the risk of bugs.

Examples of code smells could be duplicated code, large classes or long methods i.e. one function, trying to do too much, or methods that are long to understand. These examples highlight that code smells can be introduced by multiple authors from different disciplines and can exist in production code, scripts like one that produces tests data or automated tests.

Engineers can prevent fundamental design flaws, maintainability issues and scalability issues before they become more serious issues by identifying and refactoring code smells. Leaving code smells can contribute to cognitive complexity which can result in engineers spending more time reading and understanding code than contributing to it.
Warning signs in code that hint at deeper structural issues without necessarily being errors themselves. Common examples include duplicated code, overly long methods, large classes that do too much, and variables with meaningless names. 

Demi described discovering SonarQube as a tool for automatically detecting and ranking code smells by severity and impact. The term captures the idea that if code "smells," something is likely off, even if it technically runs. Code smells are often precursors to technical debt if left unaddressed.
Explore MoT
Leading with AI - The London Edition image
Fri, 19 Jun
A half-day educational experience to navigate the world of AI
MoT Software Testing Essentials Certificate image
Boost your career in software testing with the MoT Software Testing Essentials Certificate. Learn essential skills, from basic testing techniques to advanced risk analysis, crafted by industry experts.
This Week in Quality image
Debrief the week in Quality via a community radio show hosted by Simon Tomes and members of the community
Subscribe to our newsletter