Empirical Assessment of the Quality of MVC Web Applications Returned by xGenerator
<p>The standard Model-View-Controller (MVC) pattern of Web applications.</p> "> Figure 2
<p>The Use Case (UC) abstraction levels across the Model Driven Architecture (MDA) layers of the Software Development Process in [<a href="#B14-computers-10-00020" class="html-bibr">14</a>].</p> "> Figure 3
<p>Overview of the MDA transformational approach in [<a href="#B14-computers-10-00020" class="html-bibr">14</a>].</p> "> Figure 4
<p>The architecture of the enterprise Web applications developed with <tt>xGenerator</tt>.</p> "> Figure 5
<p>The Spring MVC architecture as depicted in [<a href="#B16-computers-10-00020" class="html-bibr">16</a>].</p> "> Figure 6
<p>The Business UC Diagram.</p> "> Figure 7
<p>The Business UC Realization Diagram.</p> "> Figure 8
<p>The Business UC Realization the Business Actor <tt>Bank</tt> communicates with.</p> "> Figure 9
<p>The Business UC Realizations the Business Worker <tt>Customer</tt> communicates with.</p> "> Figure 10
<p>The Business UC Realizations the Business Actor <tt>ATM Technician</tt> communicates with.</p> "> Figure 11
<p>The Business object diagram.</p> "> Figure 12
<p>The Bean class diagram.</p> "> Figure 13
<p>The database of the <tt>ATMProject</tt>.</p> "> Figure 14
<p>The classes of the <tt>ATMProject</tt>.</p> "> Figure 15
<p>The graphical output of <tt>Springlint</tt> with the metrics of <a href="#computers-10-00020-t002" class="html-table">Table 2</a> for the <tt>Controller</tt> classes.</p> "> Figure 16
<p>The graphical output of <tt>Springlint</tt> with the metrics of <a href="#computers-10-00020-t002" class="html-table">Table 2</a> for the <tt>Entity</tt> classes.</p> "> Figure 17
<p>The graphical output of <tt>Springlint</tt> with the metrics of <a href="#computers-10-00020-t002" class="html-table">Table 2</a> for the <tt>Repository</tt> classes.</p> ">
Abstract
:1. Introduction
2. Background
2.1. Overview of the Software Development Process
2.2. An Overview of xGenerator
2.3. Code Metrics and Code Smells
3. The Case Study: The Automated Teller Machine (ATM) Subsystem
4. Method
- Bean classes match the Spring Entity classes.
- UseCase classes match the Spring Controller classes; but, besides implementing all the actions of the Controller layer of Spring, UseCase classes manage also the navigation of the use cases according to the UML’s definition.
- QueryContainer classes match the Spring Repository classes. The methods in both families implement queries against the underlying database; but, while QueryContainer classes may contain multiple QueryObjects referring to different Bean classes, Aniche et al. [16] postulated that Repository classes must contain a single QueryObject linked to a single Bean class.
5. The Results
- (a)
- Are there smells in your Controllers? No!
- (b)
- Are there smells in your Entities? No!
- (c)
- Are there smells in your Repositories?
- QueryContainerBankAccount Fat Repository,
- QueryContainerRepair Fat Repository,
- QueryContainerMaintenance Fat Repository.
- QueryContainerATM:
- import model.bean.ATM;
- QueryContainerBankAccount:
- import model.bean.BankAccount;
- import model.bean.Customer;
- QueryContainerMaintenance:
- import model.bean.ATM;
- import model.bean.Maintenance;
- import model.bean.MaintenanceCategory;
- import model.bean.Repair;
- QueryContainerRepair:
- import model.bean.ATM;
- import model.bean.Repair;
Threats to Validity
- Construct validity is concerned with the relationship between theory and findings. What was measured in our experiments comes from the small set of metrics introduced by Aniche et al. [15]. Those metrics cover many aspects of object-oriented programming; nonetheless, in the future, we will carry out further experiments using a larger set of metrics. Another threat to the construct validity arises because we considered only the six types of code-smells proposed in [16]. As future work, other types of code-smells detection methods will be evaluated.
- Internal validity concerns external factors that may impact the experiments’ outcome. At the moment, we are not able to exclude that projects much more complicated than ATMProject may determine results about metrics and smells somehow dissimilar from those obtained. To mitigate this issue, more experiments are needed.
- Conclusion validity refers to threats that can impact the reliability of our conclusions. The basic threat in this category comes from the adoption of metrics to assess the quality of the ATMProject. As already pointed out in Section 2.3, the assessments produced by metrics-based detection tools are prone to false-positives because this category of methods depends on the metrics thresholds. In our study, false-positives are prevented because Aniche et al. defined the thresholds by taking into account the [15].
- External validity refers to the relevance of the results and their generalizability. We conducted the experiments with a Java software project returned by a proprietary tool (xGenerator); consequently, we cannot claim generalizability of our approach to projects adopting a different programming language. At the same time, it is worth notice that the obtained good results emphasize the relevance to the industry of xGenerator.
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Sebastián, G.; Gallud, J.A.; Tesoriero, R. Code generation using model driven architecture: A systematic mapping study. J. Comput. Lang. 2020, 56, 100935. [Google Scholar] [CrossRef]
- Ciccozzi, T.; Malavolta, I.; Selic, B. Execution of UML models: A systematic review of research and practice. Softw. Syst. Model. 2019, 18, 2313–2360. [Google Scholar] [CrossRef] [Green Version]
- Czech, G.; Moser, M.; Pichler, J. A systematic mapping study on best practices for domain-specific modeling. Softw. Qual. J. 2020, 28, 663–692. [Google Scholar] [CrossRef]
- Mussbacher, G.; Amyot, D.; Breu, R.; Bruel, J.M.; Cheng, B.H.; Collet, P.; Combemale, B.; France, R.B.; Heldal, R.; Hill, J.; et al. The Relevance of Model-Driven Engineering Thirty Years from Now. In Model-Driven Engineering Languages and Systems; MODELS 2014. Lecture Notes in Computer Science; Dingel, J., Schulte, W., Ramos, I., Abrahão, S., Insfran, E., Eds.; Springer: Cham, Switzerland, 2014; Volume 8767. [Google Scholar] [CrossRef] [Green Version]
- Kahani, N.; Bagherzadeh, M.; Cordy, J.R.; Dingel, J.; Varró, D. Survey and classification of model transformation tools. Softw. Syst. Model. 2019, 18, 2361–2397. [Google Scholar] [CrossRef]
- Lano, K.; Kolahdouz-Rahimi, S.; Yassipour-Tehrani, S.; Sharbaf, M. A survey of model transformation design patterns in practice. J. Syst. Softw. 2018, 140, 48–73. [Google Scholar] [CrossRef] [Green Version]
- Whittle, J.; Hutchinson, J.; Rouncefield, M.; Burden, H.; Heldal, R. A taxonomy of tool-related issues affecting the adoption of model-driven engineering. Softw. Syst. Model. 2017, 16, 313–331. [Google Scholar] [CrossRef] [Green Version]
- Van Der Straeten, R.; Mens, T.; Van Baelen, S. Challenges in Model-Driven Software Engineering. In MODELS 2008 Workshops; LNCS 5421; Chaudron, M.R.V., Ed.; Springer: Berlin/Heidelberg, Germany, 2009; pp. 35–47. [Google Scholar]
- Mohagheghi, P.; Gilani, W.; Stefanescu, A.; Fernandez, M.A. An empirical study of the state of the practice and acceptance of model-driven engineering in four industrial cases. Empirirical Softw. Eng. 2013, 18, 89–116. [Google Scholar] [CrossRef]
- Kulkarni, V. Model Driven Software Development. A Practitioner Takes Stock and Looks into Future. In Modelling Foundations and Applications; ECMFA 2013, Lecture Notes in Computer Science; Van Gorp, P., Ritter, T., Rose, L.M., Eds.; Springer: Berlin/Heidelberg, Germany, 2013; Volume 7949. [Google Scholar] [CrossRef]
- Cuadrado, J.S.; Izquierdo, J.L.C.; Molina, J.G. Applying model-driven engineering in small software enterprises. Sci. Comput. Program. 2014, 89, 176–198. [Google Scholar] [CrossRef] [Green Version]
- Hutchinson, J.; Whittle, J.; Rouncefield, M. Model-driven engineering practices in industry: Social, organizational and managerial factors that lead to success or failure. Sci. Comput. Program. 2014, 89, 144–161. [Google Scholar] [CrossRef]
- Bucchiarone, A.; Cabot, J.; Paige, J.R.F.; Pierantonio, A. Grand challenges in model-driven engineering: An analysis of the state of the research. Softw. Syst. Model. 2020, 19, 5–13. [Google Scholar] [CrossRef] [Green Version]
- Paolone, G.; Marinelli, M.; Paesani, R.; Di Felice, P. Automatic Code Generation of MVC Web Applications. Computers 2020, 9, 56. [Google Scholar] [CrossRef]
- Aniche, M.; Treude, C.; Zaidman, A.; van Deursen, A.; Gerosa, M.A. SATT: Tailoring Code Metric Thresholds for Different Software Architectures. In Proceedings of the IEEE 16th International Working Conference on Source Code Analysis and Manipulation (SCAM), Raleigh, NC, USA, 2–3 October 2016; pp. 41–50. [Google Scholar] [CrossRef] [Green Version]
- Aniche, A.; Bavota, G.; Treude, C.; Gerosa, M.A.; van Deursen, A. Code smells for Model-View-Controller architectures. Empir. Softw. Eng. 2018, 23, 2121–2157. [Google Scholar] [CrossRef] [Green Version]
- Object Management Group. MDA Guide Version 1.0.1; OMG Document omg/2003-06-01; Object Management Group: Needham, MA, USA, 2003. [Google Scholar]
- Jörges, S. Construction and Evolution of Code Generators: A Model-Driven and Service-Oriented Approach; Springer: Berlin/Heidelberg, Germany, 2013. [Google Scholar]
- Vlissides, J. Pattern Hatching: Design Patterns Applied; Addison-Wesley Professional: Boston, MA, USA, 1998; ISBN 0201432935. [Google Scholar]
- Pop, D.P.; Altar, A. Designing an MVC Model for Rapid Web Application Development. Procedia Eng. 2014, 69, 1172–1179. [Google Scholar] [CrossRef] [Green Version]
- Chidamber, S.R.; Kemerer, C.F. A metrics suite for object oriented design. IEEE Trans. Softw. Eng. 1994, 20, 476–493. [Google Scholar] [CrossRef] [Green Version]
- Husein, S.; Oxley, A. A Coupling and Cohesion Metrics Suite for Object-Oriented Software. In Proceedings of the 2009 International Conference on Computer Technology and Development, Kota Kinabalu, Malaysia, 13–15 November 2009; pp. 412–425. [Google Scholar] [CrossRef]
- Al Dallal, J.; Morasca, S. Predicting object-oriented class reuse-proneness using internal quality attributes. Empir. Softw. Eng. 2014, 19, 775–821. [Google Scholar] [CrossRef]
- Buse, R.P.L.; Weimer, W.R. Learning a Metric for Code Readability. IEEE Trans. Softw. Eng. 2010, 36, 546–558. [Google Scholar] [CrossRef]
- Fowler, M. Refactoring: Improving the Design of Existing Code; Addison-Wesley Professional: Boston, MA, USA, 1997. [Google Scholar]
- Tahir, A.; Dietrich, J.; Counsell, S.; Licorish, S.; Yamashita, A. A large scale study on how developers discuss code smells and anti-pattern in Stack Exchange sites. Inf. Softw. Technol. 2020, 125, 106333. [Google Scholar] [CrossRef]
- Alkharabsheh, K.; Crespo, Y.; Manso, E.; Taboada, J.A. Software Design Smell Detection: A systematic mapping study. Softw. Qual. J. 2019, 27, 1069–1148. [Google Scholar] [CrossRef]
- Sharma, T.; Spinellis, D. A survey on software smells. J. Syst. Softw. 2018, 138, 158–173. [Google Scholar] [CrossRef] [Green Version]
- Kaur, A. A Systematic Literature Review on Empirical Analysis of the Relationship Between Code Smells and Software Quality Attributes. Arch. Comput. Methods Eng. 2020, 27, 1267–1296. [Google Scholar] [CrossRef]
- Ferreira, K.A.; Bigonha, M.A.; Bigonha, R.S.; Mendes, L.F.; Almeida, H.C. Identifying thresholds for object-oriented software metrics. J. Syst. Softw. 2012, 85, 244–257. [Google Scholar] [CrossRef]
- Fontana, F.A.; Ferme, V.; Zanoni, M.; Yamashita, A. Automatic metric thresholds derivation for code smell detection. In Proceedings of the Sixth International Workshop on Emerging Trends in Software Metrics, Florence, Italy, 17 May 2015; pp. 44–53. [Google Scholar]
- Lacerda, G.; Petrillo, F.; Pimenta, M.; Guéhéneuc, Y.G. Code smells and refactoring: A tertiary systematic review of challenges and observations. J. Syst. Softw. 2020, 167, 110610. [Google Scholar] [CrossRef]
- Fontana, F.A.; Dietrich, J.; Walter, B.; Yamashita, A.; Zanoni, M. Antipattern and Code Smell False Positives: Preliminary Conceptualization and Classification. In Proceedings of the IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering, Suita, Japan, 14–18 March 2016; pp. 609–613. [Google Scholar]
- Gil, J.Y.; Lalouche, G. When do software complexity metrics mean nothing? When examined out of context. J. Object Technol. 2016, 15, 1–25. [Google Scholar] [CrossRef] [Green Version]
- Hozano, M.; Garcia, A.; Fonseca, B.; Costa, E. Are you smelling it? Investigating how similar developers detect code smells. Inf. Softw. Technol. 2018, 93, 130–146. [Google Scholar] [CrossRef]
- OMG Unified Modeling Language (OMG UML). Version 2.5.1 OMG Document Number: Formal/2017-12-05. December 2017. Available online: https/www.omg.org/spec/UML/ (accessed on 30 October 2020).
- Sunitha, E.V.; Samuel, P. Translation of behavioral models to source code. In Proceedings of the 12th International Conference on Intelligent Systems Design and Applications (ISDA), Kochi, India, 27–29 November 2012; pp. 598–604. [Google Scholar]
- Sunitha, E.V.; Samuel, P. Object constraint language for code generation from activity models. Inf. Softw. Technol. 2018, 103, 92–111. [Google Scholar] [CrossRef]
- Object Management Group; Model Driven Architecture (MDA). MDA Guide Rev. 2.0, OMG Document ormsc/2014-06-01. June 2014. Available online: http://www.smallake.kr/wp-content/uploads/2016/04/ormsc-14-06-01-2.pdf (accessed on 29 March 2020).
- Springlint. Available online: http://www.github.com/mauricioaniche/springlint (accessed on 20 June 2020).
Smell Detection Method | Number of References |
---|---|
Metrics-based | 19 |
Rule/Heuristics-based | 15 |
Machine learning-based | 6 |
Optimization-based | 4 |
History-based | 2 |
Metric | Acronym | Meaning |
---|---|---|
Coupling between Object Classes | CBO | The number of classes a class depends upon. It counts classes |
used from both external | ||
libraries as well as classes from the project. | ||
Lack of COhesion in Methods | LCOM | The lack of cohesion in a class counts the |
number of intersections between methods and attributes. The higher the number, the less cohesive is the class. | ||
Number Of Methods | NOM | Number of methods in a class. |
Response For a Class | RFC | It is the count of all method invocations that happen in a class. |
Weighted Methods per Class | WMC | Sum of McCabe’s cyclomatic complexity for |
each method in the class. |
Architectural Role | CBO | LCOM | NOM | RFC | WMC |
---|---|---|---|---|---|
Controller | [26,29,34] | [33,95,435] | [16,22,37] | [62,78,110] | [57,83,130] |
Repository | [15,21,31] | [36,106,351] | [19,26,41] | [50,76,123] | [60,104,212] |
Service | [27,34,47] | [133,271,622] | [23,32,45] | [88,123,190] | [97,146,229] |
Entity | [16,20,25] | [440,727,1844] | [33,42,64] | [8,12,25] | [49,61,88] |
Component | [20,25,36] | [50,123,433] | [15,22,35] | [56,81,132] | [52,79,125] |
Smell | Description |
---|---|
Promiscuous Controller | Offer too many actions |
Brain Controller | Too much flow control |
Meddling Service | The service directly query the database |
Brain Repository | Complex logic in the repository |
Laborious Repository Method | A method having multiple actions |
Fat Repository | A repository managing too many entities |
Metric | Threshold | |
---|---|---|
Promiscuous Controller | ||
Number of Routes (NOR) | 10 | |
Number of Services as Dependencies (NSD) | 3 | |
Brain Controller | ||
Non-Framework RFC (NFRFC) | 55 | |
Brain Repository | ||
McCabe’s Complexity | 24 | |
SQL Complexity | 29 | |
Fat Repository | ||
Coupling to Entities (CTE) | 1 |
CBO | LCOM | NOM | RFC | WMC | |
---|---|---|---|---|---|
UseCaseCheckBalance | 7 | 24 | 6 | 27 | 11 |
UseCaseDeposit | 9 | 24 | 6 | 43 | 10 |
UseCaseMaintenance | 14 | 6 | 4 | 12 | 16 |
UseCaseRegisterATM | 12 | 6 | 4 | 6 | |
UseCaseRepair | 14 | 6 | 4 | 12 | 16 |
UseCaseTransfer | 10 | 35 | 8 | 51 | 17 |
UseCaseWithdraw | 9 | 28 | 7 | 48 | 16 |
CBO | LCOM | NOM | RFC | WMC | |
---|---|---|---|---|---|
ATM | 8 | 56 | 12 | 1 | 12 |
BankAccount | 12 | 120 | 17 | 17 | |
Currency | 7 | 11 | 6 | 1 | 6 |
Customer | 9 | 91 | 15 | 15 | |
Maintenance | 12 | 45 | 11 | 11 | |
MaintenanceCategory | 7 | 7 | 6 | 6 | |
Repair | 11 | 28 | 9 | 9 | |
Transaction | 12 | 120 | 17 | 17 |
CBO | LCOM | NOM | RFC | WMC | |
---|---|---|---|---|---|
QueryContainerATM | 7 | 3 | 3 | 6 | 3 |
QueryContainerBankAccount | 6 | 4 | 6 | 5 | |
QueryContainerMaintenance | 13 | 3 | 3 | 5 | 3 |
QueryContainerRepair | 12 | 3 | 3 | 6 | 3 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Share and Cite
Paolone, G.; Paesani, R.; Marinelli, M.; Di Felice, P. Empirical Assessment of the Quality of MVC Web Applications Returned by xGenerator. Computers 2021, 10, 20. https://doi.org/10.3390/computers10020020
Paolone G, Paesani R, Marinelli M, Di Felice P. Empirical Assessment of the Quality of MVC Web Applications Returned by xGenerator. Computers. 2021; 10(2):20. https://doi.org/10.3390/computers10020020
Chicago/Turabian StylePaolone, Gaetanino, Romolo Paesani, Martina Marinelli, and Paolino Di Felice. 2021. "Empirical Assessment of the Quality of MVC Web Applications Returned by xGenerator" Computers 10, no. 2: 20. https://doi.org/10.3390/computers10020020
APA StylePaolone, G., Paesani, R., Marinelli, M., & Di Felice, P. (2021). Empirical Assessment of the Quality of MVC Web Applications Returned by xGenerator. Computers, 10(2), 20. https://doi.org/10.3390/computers10020020