A Complexity Metrics Suite for Cascading Style Sheets
Abstract
1. Introduction
2. Definition and Demonstration of Proposed Metrics
/* CSS Code Listing 1 */
* {
padding: 0;
margin: 0;
}
a {
text-decoration: underline;
color: #FFF;
}
a:hover {
text-decoration: none;
}
body {
background: #281525 url(images/bg0.jpg) top center no-repeat;
background-size: 100%;
line-height: 1.75em;
color: #CCB7C0;
font-size: 12pt;
}
h2 {
font-size: 1.75em;
}
h2,h3,h4 {
color: #FFF;
font-family: Abel, sans-serif;
margin-bottom: 1em;
}
h3 {
font-size: 1.5em;
}
h4 {
font-size: 1.25em;
}
#content {
padding: 0;
width: 765px;
float: left;
}
#footer {
text-align: center;
margin: 40px 0 80px 0;
color: #543E51;
text-shadow: 1px 1px 1px rgba(0,0,0,0.75);
}
2.1. Rule Length (RL)
- Selector attribute(s) finishing with a semicolon “;”, e.g., “color: #00FF00”;
- Selector(s) and an opening brace of a rule block “{”, e.g., “body {” as well as
- A closing brace of a rule block represented by “}”
2.2. Number of Rule Blocks (NORB)
/* Syntax of a rule block */
selector [, selector2, …] [:pseudo-class] {
property: value;
property2: value2;
…
propertyN: valueN;
}
2.3. Entropy Metric (E)
- C1 = {*, a} = 2 elements
- C2 = {a:hover} = 1 element
- C3 = {body} = 1 element
- C4 = {h2, h3, h4} = 3 elements
- C5 = {{h2, h3, h4}} = 1 element
- C6 = {#content} = 1 element
- C7 = {#footer} = 1 element
2.4. Number of Extended Rule Blocks (NERB)
2.5. Number of Attributes Defined per Rule Block (NADRB)
2.6. Number of Cohesive Rule Blocks (NCRB)
3. Validation of the Proposed Metrics
3.1. Theoretical Validation by Weyuker’s Properties
3.2. Empirical Validation
3.3. Assessment of Risk
4. Results
4.1. Dataset
4.2. Performance of the Measures against Weyuker’s Properties
4.3. Empirical and Statistical Evaluation Results
4.4. Threats to Validity
4.5. Discussion
5. Conclusions
Author Contributions
Funding
Conflicts of Interest
Appendix A
References
- Pressman, R.S. Software Engineering: A Practitioner’s Approach; McGraw-Hill: New York, NY, USA, 2005. [Google Scholar]
- Kumari, M.; Misra, A.; Misra, S.; Sanz, L.F.; Damasevicius, R.; Singh, V.B. Quantitative quality evaluation of software products by considering summary and comments entropy of a reported bug. Entropy 2019, 21, 91. [Google Scholar] [CrossRef] [Scilit]
- Gupta, A.; Suri, B.; Kumar, V.; Misra, S.; Blažauskas, T.; Damaševičius, R. Software code smell prediction model using shannon, rényi and tsallis entropies. Entropy 2018, 20, 372. [Google Scholar] [CrossRef] [Scilit]
- 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] [Scilit]
- Wang, Y. On Cognitive Informatics. In Proceedings of the Second IEEE International Conference on Cognitive Informatics (ICCI 2002), London, UK, 20–20 August 2003. [Google Scholar]
- Misra, S.; Akman, I.; Koyuncu, M. An Inheritance Complexity Metric for Object Oriented Code: A Cognitive Approach. SADHANA 2011, 36, 317–338. [Google Scholar] [CrossRef] [Scilit]
- Misra, S.; Akman, I. Weighted Class Complexity: A Measure of Complexity for Object Oriented Systems. J. Inf. Sci. Eng. 2008, 24, 1689–1708. [Google Scholar]
- Wang, Y.; Shao, J. A New Measure of Software Complexity based on Cognitive Weights. Can. J. Electr. Comput. Eng. 2003, 28, 69–74. [Google Scholar]
- Misra, S.; Adewumi, A.; Fernandez-Sanz, L.; Damasevicius, R. A suite of object oriented cognitive complexity metrics. IEEE Access 2018, 6, 8782–8796. [Google Scholar] [CrossRef] [Scilit]
- Halstead, M.H. Elements of Software Science, Operating, and Programming Systems Series; Elsevier: New York, NY, USA, 1977; Volume 7. [Google Scholar]
- McCabe, T.J. A complexity measure. IEEE Trans. Softw. Eng. 1976, 4, 308–320. [Google Scholar] [CrossRef] [Scilit]
- Chidamber, S.R.; Kemerer, C.F. A Metrics Suite for Object Oriented Design. IEEE Trans. Softw. Eng. 1994, 20, 476–493. [Google Scholar] [CrossRef] [Scilit]
- Damaševičius, R.; Štuikys, V. Metrics for evaluation of metaprogram complexity. Comput. Sci. Inf. Syst. 2010, 7, 770–787. [Google Scholar] [CrossRef] [Scilit]
- Basci, D.; Misra, S. Entropy as a Measure of Quality of XML Schema Document. Int. Arab J. Inf. Technol. 2011, 8, 16–24. [Google Scholar]
- Basci, D.; Misra, S. Data Complexity Metrics for XML Web Services. Adv. Electr. Comput. Eng. 2009, 9, 9–15. [Google Scholar] [CrossRef] [Scilit]
- Basci, D.; Misra, S. Metrics Suite for Maintainability of XML Web Services. IET Softw. 2011, 5, 320–341. [Google Scholar]
- Basci, D.; Misra, S. Entropy Metric for XML DTD Documents. ACM SIGSOFT Softw. Eng. Notes 2008, 33, 5. [Google Scholar] [CrossRef] [Scilit]
- Feuerlicht, G.; Hartman, D. Estimating the complexity of software services using an entropy based metric, 2016. In Service-Oriented Computing—ICSOC 2015 Workshops; Norta, A., Gaaloul, W., Gangadharan, G., Dam, H., Eds.; Lecture Notes in Computer Science; Springer: Berlin/Heidelberg, Germany, 16–19 November 2015; Volume 9586. [Google Scholar] [CrossRef] [Scilit]
- Pušnik, M.; Heričko, M.; Budimac, Z.; Šumak, B. XML schema metrics for quality evaluation. Comput. Sci. Inf. Syst. 2014, 11, 1271–1290. [Google Scholar] [CrossRef] [Scilit]
- Falola, O.; Misra, S.; Adewumi, A.; Damasevičius, R. Evaluation and comparison of metrics for XML schema languages. International Conference of the Catalan Association for Artificial Intelligence. In Frontiers in Artificial Intelligence and Applications 300; IOS Press: Amsterdam, The Netherlands, 2017. [Google Scholar] [CrossRef] [Scilit]
- Damasevicius, R.; Stuikys, V. Separation of Concerns in Multi-language Specifications. Informatica 2002, 13, 255–274. [Google Scholar]
- Marden, P.M.; Munson, E.V. Today’s Style Sheet Standards: The Great Vision Blinded. Computer 1999, 32, 123–125. [Google Scholar] [CrossRef] [Scilit]
- Keller, M.; Nussbaumer, M. CSS Code Quality: A Metric for Abstractness. In Proceedings of the Seventh International Conference on the Quality of Information and Communications Technology, Porto, Portugal, 29 October 2010; pp. 116–121. [Google Scholar]
- Mesbah, A.; Mirshokraie, S. Automated Analysis of CSS Rules to Support Style Maintenance. In Proceedings of the 34th International Conference on Software Engineering, Zurich, Switzerland, 2–9 June 2012; pp. 408–418. [Google Scholar]
- Adewumi, A.; Misra, S.; Ikhu-Omoregbe, N. Complexity Metrics for Cascading Style Sheets. In Proceedings of the 12th International conference on Computational Science and Its Applications, ICCSA 2012, Salvador de Bahia, Brazil, 18–21 June 2012; pp. 248–257. [Google Scholar]
- Misra, S. Modified Set of Weyuker’s properties. In Proceedings of the IEEE (ICCI ‘06), Istanbul, Turkey, 11–15 June 2006; pp. 242–247. [Google Scholar]
- Misra, S. Weyuker’s properties, language independency and object oriented metrics. In Proceedings of the International Conference on Computational Science and Its Applications, ICCSA 2009, Seoul, Korea, 29 June–2 July 2009; pp. 70–81. [Google Scholar] [CrossRef] [Scilit]
- Weyuker, E.J. Evaluating software complexity measure. IEEE Trans. Softw. Eng. 1988, 14, 1357–1365. [Google Scholar] [CrossRef] [Scilit]
- Misra, S. An Analysis of Weyuker’s Properties and Measurement Theory. Proc. Indian Natl. Sci. Acad. 2010, 76, 55–66. [Google Scholar]
- Cherniavsky, J.C.; Smith, C.H. On Weyuker’s axioms for software complexity measures. IEEE Trans. Softw. Eng. 1991, 17, 636–638. [Google Scholar] [CrossRef] [Scilit]
- Herbold, S.; Grabowski, J.; Waack, S. Calculation and optimization of thresholds for sets of software metrics. Empir. Softw. Eng. 2011, 16, 812–841. [Google Scholar] [CrossRef] [Scilit]
- Yamashita, K.; Huang, C.; Nagappan, M.; Kamei, Y.; Mockus, A.; Hassan, A.E.; Ubayashi, N. Thresholds for Size and Complexity Metrics: A Case Study from the Perspective of Defect Density. In Proceedings of the IEEE Int Conference on Software Quality, Reliability and Security (QRS), Vienna, Austria, 1–3 August 2016. [Google Scholar] [CrossRef] [Scilit]
- Shatnawi, R. A quantitative investigation of the acceptable risk levels of object-oriented metrics in open-source systems. IEEE Trans. Softw. Eng. (TSE) 2010, 36, 216–225. [Google Scholar] [CrossRef] [Scilit]
- Alves, T.L.; Ypma, C.; Visser, J. Deriving metric thresholds from benchmark data. In Proceedings of the IEEE International Conference on Software Maintenance, Timisoara, Romania, 12–18 September 2010; pp. 1–10. [Google Scholar] [CrossRef] [Scilit]
- Ghasemi, A.; Zahediasl, S. Normality tests for statistical analysis: A guide for non-statisticians. Int. J. Endocrinol. Metab. 2012, 10, 486–489. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Zhang, F.; Mockus, A.; Zou, Y.; Khomh, F.; Hassan, A.E. How Does Context Affect the Distribution of Software Maintainability Metrics? In Proceedings of the 29th IEEE International Conference on Software Maintenance, Eindhoven, The Netherlands, 1 January 2013; pp. 350–359. [Google Scholar] [CrossRef] [Scilit]
- Sheskin, D.J. Handbook of Parametric and Nonparametric Statistical Procedures, 4th ed.; Chapman Hall/CRC: Eugene, OR, USA, 2007. [Google Scholar]
- Cliff, N. Ordinal Methods for Behavioral Data Analysis; Erlbaum: Mahwah, NJ, USA, 1996. [Google Scholar]
- Akoglu, H. User’s guide to correlation coefficients. Turk. J. Emerg. Med. 2018, 18, 91–93. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Misra, S.; Akman, I. Applicability of weyuker’s properties on oo metrics: Some misunderstandings. ComSIS 2008, 5, 17–24. [Google Scholar] [CrossRef] [Scilit]
- He, P.; Ma, Y.; Li, B. TDSelector: A Training Data Selection Method for Cross-Project Defect Prediction. arXiv 2016, arXiv:1612.09065. [Google Scholar]
- El Emam, K.; Benlarbi, S.; Goel, N.; Melo, W.; Lounis, H.; Rai, S.N. The optimal class size for object-oriented software. IEEE Trans. Softw. Eng. 2002, 28, 494–509. [Google Scholar] [CrossRef]
- Zhou, Y.; Leung, H.; Xu, B. Examining the potentially confounding effect of class size on the associations between object-oriented metrics and change-proneness. IEEE Trans. Softw. Eng. 2009, 35, 607–623. [Google Scholar] [CrossRef] [Scilit]
- Jiarpakdee, J.; Tantithamthavorn, C.; Hassan, A.E. The Impact of Correlated Metrics on the Interpretation of Defect Models. IEEE Trans.Softw. Eng. 2019. [Google Scholar] [CrossRef] [Scilit]
- Yin, R.K. Case Study Research: Design and Methods, 3rd ed.; SAGE Publications: Thousand Oaks, CA, USA, 2002. [Google Scholar]
- Ulziit, B.; Warraich, Z.A.; Gencel, C.; Petersen, K. A conceptual framework of challenges and solutions for managing global software maintenance. J. Softw. Evol. Proc. 2015, 27, 763–792. [Google Scholar] [CrossRef] [Scilit]
- Hecht, M.; Tang, D.; Hecht, H.; Brill, R.W. Quantitative reliability and availability assessment for critical systems including software. In Proceedings of the COMPASS ’97, Annual Conference on Computer Assurance, Gaithersburg, MD, USA, 16–19 June 1997; pp. 147–158. [Google Scholar]
- Li, L.; Lu, M.; Gu, T. A systematic modeling approach for failure indicators of complex software-intensive systems. In Proceedings of the 12th International Conference on Reliability, Maintainability, and Safety, ICRMSS, Shanghai, China, 17–19 October 2018; pp. 43–51. [Google Scholar] [CrossRef] [Scilit]







| Percentile | Risk Category | Risk Value |
|---|---|---|
| 70% | Low | 0 |
| 80% | Moderate | ½ |
| 90% | High | 1 |
| ID | RL | NORB | E | NERB | NADRB | NCRB | SIZE (kB) |
|---|---|---|---|---|---|---|---|
| 1 | 224 | 48 | 2.3681 | 3 | 2.67 | 20 | 118 |
| 2 | 329 | 65 | 2.8601 | 4 | 3.06 | 16 | 340 |
| 3 | 368 | 74 | 2.8933 | 7 | 2.96 | 19 | 391 |
| 4 | 300 | 63 | 2.8951 | 7 | 2.84 | 16 | 123 |
| 5 | 463 | 89 | 2.9670 | 8 | 3.20 | 22 | 265 |
| 6 | 364 | 73 | 2.8543 | 6 | 2.97 | 18 | 301 |
| 7 | 280 | 59 | 2.4394 | 4 | 2.75 | 21 | 148 |
| 8 | 362 | 77 | 2.8475 | 7 | 2.66 | 23 | 85.7 |
| 9 | 205 | 48 | 2.6844 | 4 | 2.27 | 15 | 265 |
| 10 | 340 | 69 | 2.8635 | 6 | 2.93 | 15 | 180 |
| 11 | 298 | 62 | 2.8028 | 6 | 2.81 | 18 | 98.8 |
| 12 | 258 | 52 | 2.8809 | 6 | 2.96 | 11 | 1090 |
| 13 | 336 | 65 | 3.0634 | 7 | 3.19 | 15 | 34.3 |
| 14 | 292 | 62 | 2.9080 | 7 | 2.71 | 15 | 37.8 |
| 15 | 359 | 73 | 2.9353 | 6 | 2.92 | 17 | 295 |
| 16 | 300 | 62 | 2.8028 | 6 | 2.82 | 18 | 174 |
| 17 | 248 | 48 | 2.9561 | 6 | 3.08 | 8 | 1390 |
| 18 | 360 | 69 | 2.8185 | 6 | 2.87 | 17 | 743 |
| 19 | 296 | 62 | 2.9032 | 8 | 2.77 | 17 | 70.4 |
| 20 | 305 | 63 | 2.7977 | 6 | 2.84 | 16 | 88.5 |
| 21 | 339 | 69 | 2.8060 | 6 | 2.91 | 17 | 246 |
| 22 | 298 | 63 | 2.8877 | 7 | 2.73 | 16 | 169 |
| 23 | 343 | 69 | 2.8435 | 6 | 2.97 | 17 | 141 |
| 24 | 332 | 70 | 2.7145 | 6 | 2.73 | 22 | 509 |
| 25 | 348 | 74 | 2.6639 | 6 | 2.70 | 20 | 57.1 |
| 26 | 307 | 61 | 2.9648 | 7 | 3.02 | 16 | 30.7 |
| 27 | 253 | 54 | 2.6322 | 4 | 2.69 | 20 | 194 |
| 28 | 373 | 77 | 2.8725 | 7 | 2.84 | 21 | 315 |
| 29 | 249 | 50 | 2.8916 | 3 | 2.98 | 13 | 72.8 |
| 30 | 276 | 60 | 2.7650 | 6 | 2.60 | 19 | 147 |
| 31 | 309 | 65 | 2.8749 | 7 | 2.77 | 16 | 143 |
| 32 | 349 | 70 | 2.9146 | 7 | 2.99 | 15 | 190 |
| 33 | 302 | 61 | 2.9095 | 7 | 2.92 | 18 | 56.8 |
| 34 | 260 | 53 | 2.8763 | 6 | 2.91 | 12 | 803 |
| 35 | 349 | 74 | 2.6783 | 6 | 2.72 | 20 | 121 |
| 36 | 395 | 79 | 2.8925 | 7 | 3.00 | 18 | 226 |
| 37 | 374 | 73 | 3.0873 | 7 | 3.11 | 15 | 156 |
| 38 | 475 | 94 | 2.8554 | 7 | 3.00 | 20 | 374 |
| 39 | 628 | 121 | 2.5217 | 7 | 2.07 | 44 | 128 |
| 40 | 354 | 69 | 2.6601 | 3 | 3.13 | 20 | 540 |
| Measures | RL | NORB | E | NERB | NADRB | NCRB | |
|---|---|---|---|---|---|---|---|
| Property | |||||||
| 1 | * | * | * | * | * | * | |
| 2 | * | * | * | * | * | * | |
| 3 | * | * | * | * | * | * | |
| 4 | - | - | - | - | - | - | |
| 5 | * | * | * | * | * | * | |
| 6 | - | - | - | - | * | - | |
| 7 | - | - | - | - | - | - | |
| 8 | * | * | * | * | * | * | |
| 9 | - | - | - | - | - | - | |
© 2019 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
Adewumi, A.; Misra, S.; Damaševičius, R. A Complexity Metrics Suite for Cascading Style Sheets. Computers 2019, 8, 54. https://doi.org/10.3390/computers8030054
Adewumi A, Misra S, Damaševičius R. A Complexity Metrics Suite for Cascading Style Sheets. Computers. 2019; 8(3):54. https://doi.org/10.3390/computers8030054
Chicago/Turabian StyleAdewumi, Adewole, Sanjay Misra, and Robertas Damaševičius. 2019. "A Complexity Metrics Suite for Cascading Style Sheets" Computers 8, no. 3: 54. https://doi.org/10.3390/computers8030054
APA StyleAdewumi, A., Misra, S., & Damaševičius, R. (2019). A Complexity Metrics Suite for Cascading Style Sheets. Computers, 8(3), 54. https://doi.org/10.3390/computers8030054

