Journal of Computer Applications ›› 2022, Vol. 42 ›› Issue (6): 1702-1707.DOI: 10.11772/j.issn.1001-9081.2021061403
• National Open Distributed and Parallel Computing Conference 2021 (DPCS 2021) • Previous Articles
Shan SU, Yang ZHANG(), Dongwen ZHANG
Received:
2021-08-05
Revised:
2021-09-08
Accepted:
2021-10-20
Online:
2022-01-10
Published:
2022-06-10
Contact:
Yang ZHANG
About author:
SU Shan,born in 1995,M. S. candidate. Her research interestsinclude software refactoring.Supported by:
通讯作者:
张杨
作者简介:
苏珊(1995—),女,河北石家庄人,硕士研究生,主要研究方向:软件重构基金资助:
CLC Number:
Shan SU, Yang ZHANG, Dongwen ZHANG. Coupling related code smell detection method based on deep learning[J]. Journal of Computer Applications, 2022, 42(6): 1702-1707.
苏珊, 张杨, 张冬雯. 基于深度学习的耦合度相关代码坏味检测方法[J]. 《计算机应用》唯一官方网站, 2022, 42(6): 1702-1707.
Add to citation manager EndNote|Ris|BibTeX
URL: http://www.joca.cn/EN/10.11772/j.issn.1001-9081.2021061403
度量 | 定义 |
---|---|
CINT | 被检测方法调用其他类中方法的数量 |
CDISP | 判定一个方法耦合分散度的指标 |
CC | 其他类中调用被检测方法的方法数量 |
CM | 与被检测方法有联系的类的数量 |
MAXNESTING | 被检测方法嵌套层次结构中最多层的层数 |
Tab. 1 Metrics of code smell
度量 | 定义 |
---|---|
CINT | 被检测方法调用其他类中方法的数量 |
CDISP | 判定一个方法耦合分散度的指标 |
CC | 其他类中调用被检测方法的方法数量 |
CM | 与被检测方法有联系的类的数量 |
MAXNESTING | 被检测方法嵌套层次结构中最多层的层数 |
项目名称 | 项目领域 | NOC | NOM | LOC |
---|---|---|---|---|
argouml | UML图绘制 | 1 953 | 17 466 | 160 354 |
axion | gradle管理插件 | 35 | 313 | 1 096 |
Emmagee | 性能测试工具 | 9 | 58 | 907 |
fullsync | 文件同步工具 | 139 | 806 | 3 900 |
heritrix3 | 爬虫工具包 | 555 | 4 722 | 41 972 |
hsqldb | 数据库 | 659 | 12 915 | 227 069 |
ipscan | ip端口扫描 | 184 | 933 | 6 584 |
javacc | 词法分析器 | 180 | 1 487 | 20 861 |
jGroups | 群组通信工具 | 251 | 1 935 | 13 199 |
jparsec | 解析jQuery | 237 | 1 274 | 7 387 |
jspwiki | Wiki系统 | 30 | 2 243 | 21 296 |
keystore | 数据证书工具 | 272 | 1 593 | 21 215 |
marauroa | 服务器端框架 | 231 | 1 866 | 19 044 |
picocontainer | 微核心容器 | 1 005 | 6 862 | 48 468 |
quartz | 分布式框架 | 465 | 4 585 | 41 749 |
QuickServer | 服务器端组件 | 165 | 1 699 | 16 633 |
roller | 博客服务器 | 549 | 5 040 | 47 848 |
squirrel | 数据库工具 | 192 | 1 428 | 8 922 |
xalan | xslt处理器 | 964 | 10 359 | 188 637 |
xerces | xml解析器 | 838 | 10 717 | 142 249 |
you-jextractor | 下载工具 | 76 | 646 | 2 711 |
Tab. 2 Projects for training set
项目名称 | 项目领域 | NOC | NOM | LOC |
---|---|---|---|---|
argouml | UML图绘制 | 1 953 | 17 466 | 160 354 |
axion | gradle管理插件 | 35 | 313 | 1 096 |
Emmagee | 性能测试工具 | 9 | 58 | 907 |
fullsync | 文件同步工具 | 139 | 806 | 3 900 |
heritrix3 | 爬虫工具包 | 555 | 4 722 | 41 972 |
hsqldb | 数据库 | 659 | 12 915 | 227 069 |
ipscan | ip端口扫描 | 184 | 933 | 6 584 |
javacc | 词法分析器 | 180 | 1 487 | 20 861 |
jGroups | 群组通信工具 | 251 | 1 935 | 13 199 |
jparsec | 解析jQuery | 237 | 1 274 | 7 387 |
jspwiki | Wiki系统 | 30 | 2 243 | 21 296 |
keystore | 数据证书工具 | 272 | 1 593 | 21 215 |
marauroa | 服务器端框架 | 231 | 1 866 | 19 044 |
picocontainer | 微核心容器 | 1 005 | 6 862 | 48 468 |
quartz | 分布式框架 | 465 | 4 585 | 41 749 |
QuickServer | 服务器端组件 | 165 | 1 699 | 16 633 |
roller | 博客服务器 | 549 | 5 040 | 47 848 |
squirrel | 数据库工具 | 192 | 1 428 | 8 922 |
xalan | xslt处理器 | 964 | 10 359 | 188 637 |
xerces | xml解析器 | 838 | 10 717 | 142 249 |
you-jextractor | 下载工具 | 76 | 646 | 2 711 |
方法 | CINT | CDISP | MAXNESTING | INTENSIVE |
---|---|---|---|---|
exit | 0.38 | 16 | 3 | 1 |
setTool | 1 | 1 | 2 | 0 |
setTime | 1 | 1 | 2 | 0 |
unlock | 0.18 | 11 | 3 | 1 |
Tab. 3 Training set of Intensive Coupling
方法 | CINT | CDISP | MAXNESTING | INTENSIVE |
---|---|---|---|---|
exit | 0.38 | 16 | 3 | 1 |
setTool | 1 | 1 | 2 | 0 |
setTime | 1 | 1 | 2 | 0 |
unlock | 0.18 | 11 | 3 | 1 |
项目名称 | 项目领域 | NOC | NOM | LOC |
---|---|---|---|---|
ArtOfIllusion | 3D动画 | 492 | 6 766 | 103 586 |
FreePlane | 思维导图 | 787 | 6 938 | 124 937 |
jasperreports | 报表工具 | 2 890 | 23 055 | 202 308 |
Jdeodorant | 代码结构分析 | 391 | 4 265 | 84 726 |
jEdit | 文本编辑器 | 584 | 7 418 | 104 771 |
jfreechart | 图表绘制类库 | 713 | 6 953 | 70 227 |
pmd | 代码检查工具 | 2 194 | 10 105 | 51 296 |
elasticsearch | 搜索服务器 | 3 356 | 31 160 | 198 869 |
netty | Java开源框架 | 2 458 | 27 183 | 212 343 |
omega | 辅助翻译工具 | 631 | 4 543 | 39 153 |
Tab. 4 Projects for test set
项目名称 | 项目领域 | NOC | NOM | LOC |
---|---|---|---|---|
ArtOfIllusion | 3D动画 | 492 | 6 766 | 103 586 |
FreePlane | 思维导图 | 787 | 6 938 | 124 937 |
jasperreports | 报表工具 | 2 890 | 23 055 | 202 308 |
Jdeodorant | 代码结构分析 | 391 | 4 265 | 84 726 |
jEdit | 文本编辑器 | 584 | 7 418 | 104 771 |
jfreechart | 图表绘制类库 | 713 | 6 953 | 70 227 |
pmd | 代码检查工具 | 2 194 | 10 105 | 51 296 |
elasticsearch | 搜索服务器 | 3 356 | 31 160 | 198 869 |
netty | Java开源框架 | 2 458 | 27 183 | 212 343 |
omega | 辅助翻译工具 | 631 | 4 543 | 39 153 |
模型 | 标签 | 查准率 | 查全率 | |
---|---|---|---|---|
CNN | 0 | 100.00 | 99.90 | 99.95 |
1 | 89.44 | 99.73 | 94.30 | |
Attention-CNN | 0 | 100.00 | 99.94 | 99.97 |
1 | 93.61 | 100.00 | 96.70 |
Tab. 5 Results of detection of Intensive Coupling
模型 | 标签 | 查准率 | 查全率 | |
---|---|---|---|---|
CNN | 0 | 100.00 | 99.90 | 99.95 |
1 | 89.44 | 99.73 | 94.30 | |
Attention-CNN | 0 | 100.00 | 99.94 | 99.97 |
1 | 93.61 | 100.00 | 96.70 |
模型 | 标签 | 查准率 | 查全率 | |
---|---|---|---|---|
CNN | 0 | 100.00 | 99.99 | 99.99 |
1 | 99.04 | 100.00 | 99.52 | |
Attention-CNN | 0 | 100.00 | 100.00 | 100.00 |
1 | 99.76 | 99.76 | 99.76 |
Tab. 6 Results of detection of Dispersed Coupling
模型 | 标签 | 查准率 | 查全率 | |
---|---|---|---|---|
CNN | 0 | 100.00 | 99.99 | 99.99 |
1 | 99.04 | 100.00 | 99.52 | |
Attention-CNN | 0 | 100.00 | 100.00 | 100.00 |
1 | 99.76 | 99.76 | 99.76 |
模型 | 标签 | 查准率 | 查全率 | F1 |
---|---|---|---|---|
CNN | 0 | 100.00 | 99.99 | 99.99 |
1 | 98.59 | 100.00 | 99.45 | |
Attention-CNN | 0 | 100.00 | 99.92 | 99.96 |
1 | 95.66 | 100.00 | 97.78 |
Tab. 7 Results of detection of Shotgun Surgery
模型 | 标签 | 查准率 | 查全率 | F1 |
---|---|---|---|---|
CNN | 0 | 100.00 | 99.99 | 99.99 |
1 | 98.59 | 100.00 | 99.45 | |
Attention-CNN | 0 | 100.00 | 99.92 | 99.96 |
1 | 95.66 | 100.00 | 97.78 |
模型 | 过紧的耦合 | 分散的耦合 | 散弹式修改 |
---|---|---|---|
CNN | 130.49 | 150.85 | 61.21 |
Attention-CNN | 131.68 | 157.60 | 69.58 |
Tab. 8 Time consumption of three code smells
模型 | 过紧的耦合 | 分散的耦合 | 散弹式修改 |
---|---|---|---|
CNN | 130.49 | 150.85 | 61.21 |
Attention-CNN | 131.68 | 157.60 | 69.58 |
1 | MENS T, TOURWE T. A survey of software refactoring[J]. IEEE Transactions on Software Engineering, 2004, 30(2): 126-139. 10.1109/tse.2004.1265817 |
2 | FOWLER M, BECK K, BRANT J, et al. Refactoring: Improving the Design of Existing Code[M]. Boston: Addison-Wesley Professional, 1999: 71-76. |
3 | APRIL A, ABRAN A. Software Maintenance Management: Evaluation and Continuous Improvement [M]. Hoboken: John Wiley & Sons, 2012: 1-5. |
4 | YOSHIDA N, KINOSHITA M, IIDA H. A cohesion metric approach to dividing source code into functional segments to improve maintainability[C]// Proceedings of the 16th European Conference on Software Maintenance and Reengineering. Piscataway: IEEE, 2012: 365-370. 10.1109/csmr.2012.45 |
5 | PALOMBA F, BAVOTA G, DI PENTA M, et al. Mining version histories for detecting code smells[J]. IEEE Transactions on Software Engineering, 2015, 41(5): 462-489. 10.1109/tse.2014.2372760 |
6 | SALES V, TERRA R, MIRANDA L F, et al. Recommending move method refactorings using dependency sets[C]// Proceedings of the 20th Working Conference on Reverse Engineering. Piscataway: IEEE, 2013: 232-241. 10.1109/wcre.2013.6671298 |
7 | MÄNTYLÄ M V, LASSENIUS C. Subjective evaluation of software evolvability using code smells: an empirical study[J]. Empirical Software Engineering, 2006, 11(3): 395-431. 10.1007/s10664-006-9002-8 |
8 | MAIGA A, ALI N, BHATTACHARYA N, et al. Support vector machines for anti-pattern detection[C]// Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering. Piscataway: IEEE, 2012: 278-281. 10.1145/2351676.2351723 |
9 | KREIMER J. Adaptive detection of design flaws[J]. Electronic Notes in Theoretical Computer Science, 2005, 141(4): 117-136. 10.1016/j.entcs.2005.02.059 |
10 | FONTANA F A, MÄNTYLÄ M V, ZANONI M, et al. Comparing and experimenting machine learning techniques for code smell detection[J]. Empirical Software Engineering, 2016, 21(3): 1143-1191. 10.1007/s10664-015-9378-4 |
11 | DI NUCCI D, PALOMBA F, TAMBURRI D A, et al. Detecting code smells using machine learning techniques: are we there yet? [C]// Proceedings of the 2018 IEEE 25th International Conference on Software Analysis, Evolution and Reengineering. Piscataway: IEEE, 2018: 612-621. 10.1109/saner.2018.8330266 |
12 | BENGIO Y, COURVILLE A, VINCENT P. Representation learning: a review and new perspectives[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2013, 35(8): 1798-1828. 10.1109/tpami.2013.50 |
13 | GUO X L, SHI C Y, JIANG H. Deep semantic-based feature envy identification[C]// Proceedings of the 11th Asia-Pacific Symposium on Internetware. New York: ACM, 2019: No.19. 10.1145/3361242.3361257 |
14 | 卜依凡,刘辉,李光杰. 一种基于深度学习的上帝类检测方法[J]. 软件学报, 2019, 30(5): 1360-1374. |
BU Y F, LIU H, LI G J. God class detection approach based on deep learning[J]. Journal of Software, 2019, 30(5): 1360-1374. | |
15 | KESSENTINI W, KESSENTINI M, SAHRAOUI H, et al. A cooperative parallel search-based software engineering approach for code-smells detection[J]. IEEE Transactions on Software Engineering, 2014, 40(9): 841-861. 10.1109/tse.2014.2331057 |
16 | FU S Z, SHEN B J. Code bad smell detection through evolutionary data mining[C]// Proceedings of the 2015 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement. Piscataway: IEEE, 2015: 1-9. 10.1109/esem.2015.7321194 |
17 | VIDAL S, VAZQUEZ H, DIAZ-PACE J A, et al. JSpIRIT: a flexible tool for the analysis of code smells[C]// Proceedings of the 34th International Conference of the Chilean Computer Science Society. Piscataway: IEEE, 2015: 1-6. 10.1109/sccc.2015.7416572 |
18 | HADJ-KACEM M, BOUASSIDA N. A hybrid approach to detect code smells using deep learning[C]// Proceedings of the 13th International Conference on Evaluation of Novel Approaches to Software Engineering. Setúbal: SciTePress, 2018:137-146. 10.5220/0006709801370146 |
19 | KIM D K. Finding bad code smells with neural network models[J]. International Journal of Electrical and Computer Engineering, 2017, 7(6): 3613-3621. 10.11591/ijece.v7i6.pp3613-3621 |
20 | DAS A K, YADAV S, DHAL S. Detecting code smells using deep learning[C]// Proceedings of the 2019 IEEE Region 10 Conference. Piscataway: IEEE, 2019: 2081-2086. 10.1109/tencon.2019.8929628 |
21 | LANZA M, MARINESCU R. Object-Oriented Metrics in Practice: Using Software Metrics to Characterize, Evaluate, and Improve the Design of Object-Oriented Systems[M]. Berlin: Springer, 2006: 115-167. |
22 | CHAWLA N V, BOWYER K W, HALL L O, et al. SMOTE: synthetic minority over-sampling technique[J]. Journal of Artificial Intelligence Research, 2002, 16: 321-357. 10.1613/jair.953 |
23 | BAHDANAU D, CHO K, BENGIO Y. Neural machine translation by jointly learning to align and translate [EB/OL]. [2020-12-08]. . 10.3115/v1/w14-4009 |
[1] | Xianfeng YANG, Jiahe ZHAO, Ziqiang LI. Text classification model combining word annotations [J]. Journal of Computer Applications, 2022, 42(5): 1317-1323. |
[2] | Li’e WANG, Xiaocong LI, Hongyi LIU. News recommendation method with knowledge graph and differential privacy [J]. Journal of Computer Applications, 2022, 42(5): 1339-1346. |
[3] | Hexuan HU, Huachao SUI, Qiang HU, Ye ZHANG, Zhenyun HU, Nengwu MA. Runoff forecast model based on graph attention network and dual-stage attention mechanism [J]. Journal of Computer Applications, 2022, 42(5): 1607-1615. |
[4] | Yongshuai LU, Yingjie TANG, Xinran MA. Low contrast filament sizing defect detection method of non-woven fabric based on deep feature fusion [J]. Journal of Computer Applications, 2022, 42(5): 1440-1446. |
[5] | Daili CHEN, Guoliang XU. Cross-domain person re-identification method based on attention mechanism with learning intra-domain variance [J]. Journal of Computer Applications, 2022, 42(5): 1391-1397. |
[6] | Yi ZHUANG, Haitao ZHAO. Proposal-based aggregation network for single object tracking in 3D point cloud [J]. Journal of Computer Applications, 2022, 42(5): 1407-1416. |
[7] | Zhen QU, Kunting LI, Zhixi FENG. Remote sensing image scene classification based on effective channel attention [J]. Journal of Computer Applications, 2022, 42(5): 1431-1439. |
[8] | Ye ZHANG, Rong LIU, Ming LIU, Ming CHEN. Image super-resolution reconstruction network based on multi-channel attention mechanism [J]. Journal of Computer Applications, 2022, 42(5): 1563-1569. |
[9] | Yongru QIU, Guangle YAO, Jie FENG, Haoyu CUI. Single image de-raining algorithm based on semi-supervised learning [J]. Journal of Computer Applications, 2022, 42(5): 1577-1582. |
[10] | Wei REN, Hexiang BAI. Multi-label image classification method based on global and local label relationship [J]. Journal of Computer Applications, 2022, 42(5): 1383-1390. |
[11] | Xinlin XIE, Yi XIAO, Xinying XU. Lung nodule classification algorithm based on neural network architecture search [J]. Journal of Computer Applications, 2022, 42(5): 1424-1430. |
[12] | Zhihua LIU, Wenjie CHEN, Aibin CHEN. Homologous spectrogram feature fusion with self-attention mechanism for bird sound classification [J]. Journal of Computer Applications, 2022, 42(4): 1260-1268. |
[13] | Junhua GU, Rui WANG, Ningning LI, Suqi ZHANG. Knowledge graph attention network fusing collaborative filtering information [J]. Journal of Computer Applications, 2022, 42(4): 1087-1092. |
[14] | Yongfeng DONG, Yuehua SUN, Lichao GAO, Peng HAN, Haipeng JI. Fault diagnosis method based on improved one-dimensional convolutional and bidirectional long short-term memory neural networks [J]. Journal of Computer Applications, 2022, 42(4): 1207-1215. |
[15] | Jin ZHANG, Peiqi QU, Cheng SUN, Meng LUO. Safety helmet wearing detection algorithm based on improved YOLOv5 [J]. Journal of Computer Applications, 2022, 42(4): 1292-1300. |
Viewed | ||||||
Full text |
|
|||||
Abstract |
|
|||||