Code Smell视角下分层Web应用失血及充血现象的量化分析

黄子杰, 陈军华, 高建华

电子学报 ›› 2020, Vol. 48 ›› Issue (4) : 772-780.

PDF(3041 KB)
PDF(3041 KB)
电子学报 ›› 2020, Vol. 48 ›› Issue (4) : 772-780. DOI: 10.3969/j.issn.0372-2112.2020.04.019
学术论文

Code Smell视角下分层Web应用失血及充血现象的量化分析

  • 黄子杰, 陈军华, 高建华
作者信息 +

Quantifying Anemia and Bloodshot of Layers in Web Applications from the Perspective of Code Smell

  • HUANG Zi-jie, CHEN Jun-hua, GAO Jian-hua
Author information +
文章历史 +

摘要

分层Web应用的领域层由领域模型构成.仅存储数据且不实现行为的领域模型被称作失血领域模型,其状态和数据由非领域层中的类维护,造成后者的充血现象.失血和充血现象损害了Web应用的可维护性,然而,由于缺乏量化分析和研究,其论据多基于主观经验得出.本文度量三种Code Smell(Feature Envy、Blob和Data Class)的强度,将它们作为衡量失血和充血现象的标准,对现象进行量化分析,进而得出它们之间的相关性.本文对一个公开数据集的91个Java Web项目及10个不同领域的开源Java Web应用的多个版本进行了实验,实验发现至少有75%的项目受领域层失血和服务层充血现象的影响,这些现象极少被解决或减弱,两者的强度在不同类间存在相关性,且两者强度的增量在同一软件项目的不同版本间亦存在相关性.

Abstract

Domain Models shape the Domain Layer of Web Applications.Anemic Domain Models (ADMs) are Domain Models holding only data. States of ADMs are maintained by classes in other layers, causing the latter bloodshot. However, there lacks research revealing the significance of impact that anemia and bloodshot of layers pose on maintainability. To quantify the significance, this paper assesses intensity of 3 Code Smells (Feature Envy, Blob and Data Class) as evaluation standards. Through an experiment conducted on 91 Java projects and multiple releases of 10 Java Web applications, this paper concludes that over 75% of the projects are affected. As the impact persists, correlations of the intensities exist among different classes of a project as well as same classes in different releases of a project.

关键词

软件可维护性 / web应用 / 分层结构 / code smell / 领域建模

Key words

software maintainability / web application / layered architecture / code smell / domain modeling

引用本文

导出引用
黄子杰, 陈军华, 高建华. Code Smell视角下分层Web应用失血及充血现象的量化分析[J]. 电子学报, 2020, 48(4): 772-780. https://doi.org/10.3969/j.issn.0372-2112.2020.04.019
HUANG Zi-jie, CHEN Jun-hua, GAO Jian-hua. Quantifying Anemia and Bloodshot of Layers in Web Applications from the Perspective of Code Smell[J]. Acta Electronica Sinica, 2020, 48(4): 772-780. https://doi.org/10.3969/j.issn.0372-2112.2020.04.019
中图分类号: TP311.5   

参考文献

[1] Anemic Domain Model[EB/OL].https://www.martinfowler.com/bliki/AnemicDomainModel.html,2019-08-06.
[2] Evans E.Domain-Driven Design:Tackling Complexity in the Heart of Software[M].Boston:Addison-Wesley Professional,2004.
[3] Fowler M.Patterns of Enterprise Application Architecture[M].Boston:Addison-Wesley Longman Publishing Co,Inc,2002.
[4] Tufano M,Palomba F,Bavota G,et al.When and why your code starts to smell bad (and whether the smells go away)[J].IEEE Transactions on Software Engineering,2017,43(11):1063-1088.
[5] Fowler M,Beck K,Brant J,et al.Refactoring:Improving the Design of Existing Code[M].Boston:Addison-Wesley Professional,1999.
[6] Shopizer[EB/OL].https://github.com/shopizer-ecommerce/shopizer,2019-08-06.
[7] 李勇,黄志球,王勇,房丙午.数据驱动的软件缺陷预测研究综述[J].电子学报,2017,45(4):982-988. LI Yong,HUANG Zhi-qiu,WANG Yong,FANG Bing-wu.Survey on data driven software defects prediction[J].Acta Electronica Sinica,2017,45(4):982-988.(in Chinese)
[8] Palomba F,Panichella A,Zaidman A,et al.The scent of a smell:An extensive comparison between textual and structural smells[J].IEEE Transactions on Software Engineering,2018,44(10):977-1000.
[9] 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 Science & Business Media,2007.
[10] Palomba F,Zanoni M,Fontana F A,et al.Toward a smell-aware bug prediction model[J].IEEE Transactions on Software Engineering,2019,45(3):194-218.
[11] Fokaefs M,Tsantalis N,Chatzigeorgiou A.Jdeodorant:Identification and removal of feature envy bad smells[A].Proceedings of IEEE International Conference on Software Maintenance(ICSM)[C].NJ:IEEE,2007.519-520.
[12] Moha N,Gueheneuc Y G,Duchien A F.Decor:A method for the specification and detection of code and design smells[J].IEEE Transactions on Software Engineering,2010,36(1):20-36.
[13] Al Dallal J.Measuring the discriminative power of object-oriented class cohesion metrics[J].IEEE Transactions on Software Engineering,2011,37(6):788-804.
[14] Henderson-Sellers B,Constantine LL,Graham I M.Coupling and cohesion (towards a valid metrics suite for object-oriented analysis and design)[J].Object Oriented Systems,1996,3(3):143-158.
[15] Fernández L,Peña R.A sensitive metric of class cohesion[J].International Journal Information Theories & Applications,2006,13:82-91.
[16] Izadkhah H,Hooshyar M.Class cohesion metrics for software engineering:a critical review[J].Computer Science Journal of Moldova,2017,25(1):1-1.
[17] PMD[EB/OL].https://pmd.github.io,2019-08-06.
[18] Hayashi S,Minami F,Saeki M.Detecting architectural violations using responsibility and dependency constraints of components[J].IEICE Transactions on Information and Systems,2018,101(7):1780-1789.
[19] Aniche M,Bavota G,Treude C,et al.Code smells for model-view-controller architectures[J].Empirical Software Engineering,2018,23(4):2121-2157.
[20] 孙小兵,刘湘月,李斌,张伟佳.基于相关主题模型的程序网络自动构建与分析[J].电子学报,2017,45(5):1052-1056. SUN Xiao-bing,LIU Xiang-yue,LI Bin,ZHANG Wei-jia.On automatic construction and analysis of program network via relational topic model[J].Acta Electronica Sinica,2017,45(5):1052-1056.(in Chinese)
[21] Jpeek[EB/OL].https://github.com/yegor256/jpeek,2019-08-06.
[22] Mendes T S,Gomes F G S,Gonçalves D P,et al.VisminerTD:a tool for automatic identification and interactive monitoring of the evolution of technical debt items[J].Journal of the Brazilian Computer Society,2019,25(1):2.
[23] Zar J H.Significance testing of the Spearman rank correlation coefficient[J].Journal of the American Statistical Association,1972,67(339):578-580.
[24] The Anaemic Domain Model is no Anti-Pattern,it’s a SOLID design [EB/OL].https://blog.inf.ed.ac.uk/sapm/2014/02/04/the-anaemic-domain-model-is-no-anti-pattern-its-a-solid-design/,2019-08-06.
[25] Wirfs-Brock R.Are software patterns simply a handy way to package design heuristics?[A].Proceedings of the 24th Conference on Pattern Languages of Programs[C].Vancouver:The Hillside Group,2017.3:1-3:15.
[26] Cemus K,Cerny T,Matl L,et al.Aspect,rich,and anemic domain models in enterprise information systems[A].Proceedings of the International Conference on Current Trends in Theory and Practice of Informatics[C].Berlin:Springer,2016.445-456.
[27] Martins J,Pereira J,Fernandes S M,et al.Towards a simple programming model in Cloud Computing platforms[A].Proceedings of the 1st International Symposium on Network Cloud Computing and Applications[C].US:IEEE,2011.83-90.
[28] 叶蔚,罗睿辞,刘学洋,张世琨.BuOA:一种企业级Web应用体系结构风格[J].电子学报,2013,41(11):2120-2126. YE Wei,LUO Rui-ci,LIU Xue-yang,ZHANG Shi-kun.BuOA:An architecture style for enterprise web applications[J].Acta Electronica Sinica,2013,41(11):2120-2126.(in Chinese)
[29] Wang F,Yan L H,Zhou P,et al.The investigation of WEB software system based on domain-driven design[A].Proceedings of the International Conference on Web Information Systems and Mining[C].Berlin:Springer,2011.11-18.

基金

国家自然科学基金 (No.61672355)
PDF(3041 KB)

1177

Accesses

0

Citation

Detail

 
段落导航
相关文章

/