An Efficient Design Smell Detection Approach with Inter-class Relation (S)
Hao Zhu, Yichen Li, Jie Li, Xiaofang Zhang · Proceedings/Proceedings of the ... International Conference on Software Engineering and Knowledge Engineering · 2023
Code smell indicates the potential designed problems and quality of source code affecting the software maintenance and readability.Hence, detecting code smells in a timely and effective manner can provide guides for developers in refactoring.Existing methods generally treat these code smells from different granularities equally by merely extracting tokens-based or abstract syntax tree(AST)-based code representation, which does not take the diversity of code smells into account, especially when fewer researches concern design smells.To tackle this challenge, we propose Design Smell Detection through Inter-class Relation, which leverages the corresponding design smells features for code smell detection.More specifically, we employ AST-tokens instead of traditional word-tokens or AST to obtain code syntax information from the deep dimension.Meanwhile, we analyze the common structural feature of design smells and propose the interclass relation among different class files contained in the same package.Moreover, to verify the effectiveness of our proposed method, we carry out extensive experiments with various settings on our new dataset and the results demonstrate that our method outperforms state-of-the-art methods by up to 31% in terms of F1-measure of all code smells.The code is available at: https://github.com/xzb777/designSmellUML