Cleaning Code Smells with Clean CaDET

Dragan Vidaković
Clean CaDET
Published in
3 min readOct 29, 2020

The economy and well-being of modern society significantly depend on the software industry. Societies’ ever-growing needs and desires generate a high demand for new software solutions. Consequently, software development has become a profession in high demand. By rushing to fulfill the market’s needs, software vendors sacrifice quality to develop software products faster and with more functionality. As a result, software solutions run on low-quality code that is challenging and costly to maintain and evolve. Such code is error-prone and unreliable, resulting in failures that can harm the software’s users and its vendor’s brand.

Martin Fowler and Kent Beck [1] defined these low-quality code structures as code smells. Code smells signal the need for refactoring to avoid degrading the software’s quality attributes. As Sharma et al. [2] point out, smells negatively impact both the software product’s quality and the developers’ productivity. There is a large variety of cataloged code smells. Fowler and Beck [1] introduced 24 code smells that range from straightforward software coding problems, such as the use of repeated switch statements, to complicated structural issues, such as the occurrence of Shotgun Surgery. Since then, authors have explored smells in different domains and focus areas and came up with various code smell catalogs, neatly summarized in Sharma et al. [2].

While the loss of software quality happens partially due to poor work management, the primary reason for low-quality code is a lack of developer awareness and skill. Developers focus on getting code to fulfill the software’s requirements and often do not know how to maintain the code’s quality properly. This problem could be alleviated by introducing automated tools that help the developer maintain the code’s quality. Timely detection of code smells, and advice on how to resolve the issues can help developers build software that is easier to change — reducing the overall cost of development and enabling them to seize new opportunities.

As the number of code smells is not small, and their solution is often not straightforward, an artificial intelligence solution is required to properly detect code smells in software code. To research and develop this solution, a team of researchers from the Faculty of Technical Sciences from Novi Sad, Serbia started working on the Clean CaDET — the Clean Code and Design Educational Tool. Clean CaDET is a digital assistant for software developers that helps them build more maintainable, reliable, and secure software by automatically detecting code smells in their code and offering personalized advice on dealing with the detected smells. As a result, developers are trained to write code of higher quality.

Clean CaDET hard at work, increasing the quality of your software; Illustration by Srdja Dragovic

Encapsulation of AI algorithms into a usable open-source tool will support software developers in their work and help them discover unclean code as they write it. Detection mechanisms supplemented with educational resources will help the developer understand the smell’s nature and the best way to resolve it. Finally, Clean CaDET will be enhanced with an AI-based tutoring system that offers personalized advice and educational material to the developers to ensure their efficient learning.

Clean CaDET became a reality in September 2020, after officially receiving funding from the Science Fund of the Republic of Serbia under Grant № 6521051, AI — Clean CaDET. The team behind Clean CaDET will be happy to share knowledge acquired on this exciting journey to develop a society powered by high-quality software.

[1] Fowler, M., 2018. Refactoring: improving the design of existing code. Addison-Wesley Professional.

[2] Sharma, T. and Spinellis, D., 2018. A survey on software smells. Journal of Systems and Software, 138, pp.158–173.

--

--