Code smells in cascading style sheets : an empirical study and a predictive model

Cascading Style Sheets (CSS) is widely used in today’s web applications to separate presentation semantics from HTML content. Despite the simple syntax of CSS, the language has some characteristics, such as inheritance, cascading and specificity, which make authoring and maintaining CSS a challenging task. In this thesis, we describe a set of 26 CSS smells and errors, collected from various development resources and propose an automated technique to detect them. Additionally, we conduct a large empirical study on 500 websites, 5060 CSS files in total which consist of more than 10 million lines of CSS code, to investigate which smells and errors are more prevalent and to what extent they occur in CSS code of today’s web applications. Finally, we propose a model based on the findings of our empirical study that is capable of predicting the total number of CSS code smells in any given website which can be used by developers as a CSS code quality guidance. A study of unused CSS code on 187 websites and its results are also described in this thesis.

[1]  W. Steiger,et al.  Least Absolute Deviations: Theory, Applications and Algorithms , 1984 .

[2]  D. Tax,et al.  Feature scaling in support vector data description , 2002 .

[3]  Panita Meananeatra,et al.  Using software metrics to select refactoring for long method bad smell , 2011, The 8th Electrical Engineering/ Electronics, Computer, Telecommunications and Information Technology (ECTI) Association of Thailand - Conference 2011.

[4]  Andrew P. Black,et al.  Seven habits of a highly effective smell detector , 2008, RSSE '08.

[5]  Javam C. Machado,et al.  The prediction of faulty classes using object-oriented design metrics , 2001, J. Syst. Softw..

[6]  Stephen R. Schach,et al.  Validation of the coupling dependency metric as a predictor of run-time failures and maintenance measures , 1998, Proceedings of the 20th International Conference on Software Engineering.

[7]  Ali Mesbah,et al.  Automated analysis of CSS rules to support style maintenance , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[8]  Peter J. Stuckey,et al.  Constraint cascading style sheets for the Web , 1999, UIST '99.

[9]  X.R. Li,et al.  Relative error measures for evaluation of estimation algorithms , 2005, 2005 7th International Conference on Information Fusion.

[10]  Joseph G. Pigeon,et al.  Statistics for Experimenters: Design, Innovation and Discovery , 2006, Technometrics.

[11]  Vincent Quint,et al.  On the analysis of cascading style sheets , 2012, WWW.

[12]  Foutse Khomh,et al.  An Exploratory Study of the Impact of Code Smells on Software Change-proneness , 2009, 2009 16th Working Conference on Reverse Engineering.

[13]  Arie van Deursen,et al.  Crawling Ajax-Based Web Applications through Dynamic Analysis of User Interface State Changes , 2012, TWEB.

[14]  Hung Viet Nguyen,et al.  Detection of embedded code smells in dynamic web applications , 2012, 2012 Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering.

[15]  Bert Bos,et al.  Cascading style sheets , 1997, World Wide Web J..

[16]  Ali Mesbah,et al.  Discovering refactoring opportunities in cascading style sheets , 2014, SIGSOFT FSE.

[17]  Yann-Gaël Guéhéneuc,et al.  DECOR: A Method for the Specification and Detection of Code and Design Smells , 2010, IEEE Transactions on Software Engineering.

[18]  Ethan V. Munson,et al.  Today's Style Sheet Standards: The Gread Vision Blinded , 1999, Computer.

[19]  Vincent Quint,et al.  Editing with style , 2007, DocEng '07.

[20]  Ali Mesbah,et al.  Hidden-Web Induced by Client-Side Scripting: An Empirical Study , 2013, ICWE.

[21]  Radu Marinescu,et al.  Detection strategies: metrics-based rules for detecting design flaws , 2004, 20th IEEE International Conference on Software Maintenance, 2004. Proceedings..

[22]  Muhammad Ilyas,et al.  A Comparative Study on Code Smell Detection Tools , 2013 .

[23]  Deborah J. Rumsey,et al.  Statistics for dummies , 2011 .

[24]  Santanu Kumar Rath,et al.  Statistical and Machine Learning Methods for Software Fault Prediction Using CK Metric Suite: A Comparative Analysis , 2014 .

[25]  Janet L. Kolodner,et al.  Case-Based Reasoning , 1988, IJCAI 1989.

[26]  Ruchika Malhotra,et al.  Fault Prediction Using Statistical and Machine Learning Methods for Improving Software Quality , 2012, J. Inf. Process. Syst..

[27]  Tsutomu Ishida,et al.  Metrics and Models in Software Quality Engineering , 1995 .

[28]  Melanie Hartmann Intermediate Statistical Methods And Applications A Computer Package Approach , 2016 .

[29]  P. Oman,et al.  Metrics for assessing a software system's maintainability , 1992, Proceedings Conference on Software Maintenance 1992.

[30]  M.J. Munro,et al.  Product Metrics for Automatic Identification of "Bad Smell" Design Problems in Java Source-Code , 2005, 11th IEEE International Software Metrics Symposium (METRICS'05).

[31]  Rob J Hyndman,et al.  Another look at measures of forecast accuracy , 2006 .

[32]  Claus Lewerentz,et al.  Metrics Based Refactoring , 2001, CSMR.

[33]  Stephen G. MacDonell,et al.  A comparison of techniques for developing predictive models of software metrics , 1997, Inf. Softw. Technol..

[34]  Yan Luo Statistical defect prediction models for software quality assurance , 2007 .

[35]  Mitesh Patel,et al.  Accessing the deep web , 2007, CACM.

[36]  Amrit L. Goel,et al.  Empirical Data Modeling in Software Engineering Using Radical Basis Functions , 2000, IEEE Trans. Software Eng..

[37]  Lionel C. Briand,et al.  Empirical Studies of Quality Models in Object-Oriented Systems , 2002, Adv. Comput..

[38]  Amin Milani Fard,et al.  JSNOSE: Detecting JavaScript Code Smells , 2013, 2013 IEEE 13th International Working Conference on Source Code Analysis and Manipulation (SCAM).

[39]  W. Afzal,et al.  prediction of fault count data using genetic programming , 2008, 2008 IEEE International Multitopic Conference.

[40]  Doreen Meier,et al.  Fundamentals Of Neural Networks Architectures Algorithms And Applications , 2016 .

[41]  Audris Mockus,et al.  Quantifying the Effect of Code Smells on Maintenance Effort , 2013, IEEE Transactions on Software Engineering.

[42]  Panita Meananeatra,et al.  Identifying refactoring sequences for improving software maintainability , 2012, 2012 Proceedings of the 27th IEEE/ACM International Conference on Automated Software Engineering.

[43]  Taghi M. Khoshgoftaar,et al.  Fault Prediction Modeling for Software Quality Estimation: Comparing Commonly Used Techniques , 2003, Empirical Software Engineering.

[44]  David R. Cox,et al.  The Oxford Dictionary of Statistical Terms , 2006 .

[45]  Matthias Keller,et al.  CSS Code Quality: A Metric for Abstractness; Or Why Humans Beat Machines in CSS Coding , 2010, 2010 Seventh International Conference on the Quality of Information and Communications Technology.