Login | Register

Eliminating Code Duplication in Cascading Style Sheets


Eliminating Code Duplication in Cascading Style Sheets

Mazinanian, Davood (2017) Eliminating Code Duplication in Cascading Style Sheets. PhD thesis, Concordia University.

[thumbnail of Mazinanian_PhD_F2017.pdf]
Text (application/pdf)
Mazinanian_PhD_F2017.pdf - Accepted Version
Available under License Spectrum Terms of Access.


Cascading Style Sheets (i.e., CSS) is the standard styling language, widely used for defining the presentation semantics of user interfaces for web, mobile and desktop applications. Despite its popularity, CSS has not received much attention from academia. Indeed, developing and maintaining CSS code is rather challenging, due to the inherent language design shortcomings, the interplay of CSS with other programming languages (e.g., HTML and JavaScript), the lack of empirically- evaluated coding best-practices, and immature tool support. As a result, the quality of CSS code bases is poor in many cases.

In this thesis, we focus on one of the major issues found in CSS code bases, i.e., the duplicated code. In a large, representative dataset of CSS code, we found an average of 68% duplication in style declarations. To alleviate this, we devise techniques for refactoring CSS code (i.e., grouping style declarations into new style rules), or migrating CSS code to take advantage of the code abstraction features provided by CSS preprocessor languages (i.e., superset languages for CSS that augment it by adding extra features that facilitate code maintenance). Specifically for the migration transformations, we attempt to align the resulting code with manually-developed code, by relying on the knowledge gained by conducting an empirical study on the use of CSS preprocessors, which revealed the common coding practices of the developers who use CSS preprocessor languages.

To guarantee the behavior preservation of the proposed transformations, we come up with a list of preconditions that should be met, and also describe a lightweight testing technique. By applying a large number of transformations on several web sites and web applications, it is shown that the transformations are indeed presentation-preserving, and can effectively reduce the amount of duplicated code in CSS.

Divisions:Concordia University > Gina Cody School of Engineering and Computer Science > Computer Science and Software Engineering
Item Type:Thesis (PhD)
Authors:Mazinanian, Davood
Institution:Concordia University
Degree Name:Ph. D.
Program:Software Engineering
Date:1 September 2017
Thesis Supervisor(s):Tsantalis, Nikolaos
Keywords:Cascading Style Sheets, Code Duplication, Software Clones, Code Refactoring, Empirical Studies
ID Code:982965
Deposited On:08 Nov 2017 22:00
Last Modified:18 Jan 2018 17:56
Related URLs:
All items in Spectrum are protected by copyright, with all rights reserved. The use of items is governed by Spectrum's terms of access.

Repository Staff Only: item control page

Downloads per month over past year

Research related to the current document (at the CORE website)
- Research related to the current document (at the CORE website)
Back to top Back to top