Improving Software Design by Mitigating Code Smells

Improving Software Design by Mitigating Code Smells

Randeep Singh, Amit Kumar Bindal, Ashok Kumar
Copyright: © 2022 |Pages: 21
DOI: 10.4018/IJSI.297503
OnDemand:
(Individual Articles)
Available
$37.50
No Current Special Offers
TOTAL SAVINGS: $37.50

Abstract

Improving design is a key research challenge during software maintenance. It aims at identifying and mitigating structural characteristics that may cause future problems (code smells). The existing approaches lack in considering the developer’s expertise and penalty consideration during inheritance usage. Therefore, this paper targets identifying three key code smells viz refused bequest, shotgun surgery, and duplicated code. The refused bequest detection approach is based on probabilistic penalized inheritance usage and domain closeness among methods. The shotgun surgery is detected using combined use of co-change and usage pattern based functional relations. Finally, the duplicated code is based on the abstract tree representation and identification of longest common subsequence between the inorder/ postorder traversals. The experimental results uphold the feasibility of the proposed approach.
Article Preview
Top

Introduction

Typically, the legacy and large-scale software systems have long term evolutions/ maintenance phase for incorporating new features, bug removal, requirement change, etc. (Lehman & Belady, 1985). These long-term maintenance activities and/ or poor programming skills may result in the introduction of poor design symptoms and implementation choices. Such poor symptoms which are commonly known as code smells may cause a problem with the future evolution, adaptation, increased fault-proneness or hinders the comprehensibility of the software system (Lanza & Marinescu, 2007). Therefore, it is very much important to regularly monitor the evolution of a software system and to correctly identify such code smells. Further appropriate actions (commonly termed as refactoring) should be taken to remove these code smells (Fowler, 2018).

The refactoring steps for improving the quality of software are well defined by (Fowler, 2018). However, there is always a challenge for the appropriate mechanism for detecting various code smells. Determining such a mechanism is always time-consuming and non-trivial activity (Ligu et al., 2013). In an object-oriented development paradigm, inheritance is a tested phenomenon that often helps in reducing maintenance. However, sometimes inheritance is confused with other forms of relations (such as an association) and in such cases, it may inappropriately degrade the quality of the software system. Such a confusing situation is commonly termed as a refused bequest code smell. Many approaches are proposed in the literature to handle refused bequest code smell (Ligu et al., 2013; Li & Shatnawi, 2007, Merzah & Selçuk, 2017; Palomba et al., 2018). All of these approaches are based on some combination of trivial Cyclomatic/ Inheritance metrics (Li & Shatnawi, 2007, Merzah & Selçuk, 2017; Palomba et al., 2018) or measuring different code smell intensity factors (Ligu et al., 2013). However, such trivial metrics do not generally capture every dimension related to refused code smell and often ignores the human perception about the refused bequest code smell. Another key design flaw is termed as shotgun surgery and it represents the low-level complicated coupling among classes that may cause series of subsequent, necessary changes in response to the change in any one of the involved coupled class. In literature, many approaches are already proposed that are solely based on either the use of change history and trivial code based metrics (Palomba et al., 2013; Abílio et al., 2015; Li & Shatnawi, 2007; Olbrich et al., 2009). Such approaches lack in utilizing important function-based coupling among classes and do not tests the feasibility of combined use of change history with other code-based metrics. One more serious issue that causes increased maintenance and size is known as duplicated code/ code clones and it involves copy-pasting fragments of source code at many places in the software in order to promote reuse opportunities. Many close approaches that focus on detecting duplicated code smell involves (Jiang et al., 2007; Fu & Shen, 2015; Liu & Zhang, 2018). Roy et al. classified code clones into four categories (Roy et al., 2009). The existing approaches are either token-based, semantics-based, string-based, or tree-based. However, such approaches are not robust enough against code modifications i.e. they either do not detect type-4 (logical modifications) or they show very little efficiency.

Complete Article List

Search this Journal:
Reset
Volume 12: 1 Issue (2024)
Volume 11: 1 Issue (2023)
Volume 10: 4 Issues (2022): 2 Released, 2 Forthcoming
Volume 9: 4 Issues (2021)
Volume 8: 4 Issues (2020)
Volume 7: 4 Issues (2019)
Volume 6: 4 Issues (2018)
Volume 5: 4 Issues (2017)
Volume 4: 4 Issues (2016)
Volume 3: 4 Issues (2015)
Volume 2: 4 Issues (2014)
Volume 1: 4 Issues (2013)
View Complete Journal Contents Listing