UPM Institutional Repository

Metric-based code smell detection technique for python software


Citation

Leeman, Samaila Ja'afaru (2018) Metric-based code smell detection technique for python software. Masters thesis, Universiti Putra Malaysia.

Abstract

In software life cycle, maintenance is reported to cost between 80% and 90% of the total software cost. Instead of improving, software quality can deteriorate if maintenance of software is not carried out in line with design principles. A term, “code smell” has been framed to refer to software constructs that deviates from design principles’ implementation. Refactoring, a process of removing code smells has been recommended to improve maintainability qualities. However, for refactoring to be applied, code smells must be detected in the location where they exist. While research on code smells in Java and C++ programmed codes is mature, similar research in Python software is scarce. There are few literatures that show metric-based approaches have been used to detect code smells in Python Software. However, the techniques require selection of metrics and a tedious calibration of threshold upon which detection is done. Existing metric-based techniques anticipates parser to handle only one version of Python though Python 2 and 3 are popular and end of life for Python 2 has been announced. This research proposes an enhanced metric-based technique named PySTect that extracts structural information from parsed models of any version of Python software and translates them into metrics for detection of code smells. This research is divided into four phases. The first phase involves reviewing the literatures on code smells detection techniques, parser models, and code smells in Python software. In the second phase, details of conceptual and architectural design of the metric-based technique are presented. Thirdly, PySTect technique is implemented and evaluated in three experiments. In the first experiment, precision and recall of 100% and 96% were recorded which indicates the effectiveness of the PySTect technique in detecting five code smells. In the second and third experiments 1,167,180 lines of code from 13 open source Python projects are analysed. Results of the second experiment shows codes smell increases with evolution of Python software projects and the third experiment indicates the most dominant smells in Python SDKs are Lazy Class, Improper Method Declaration, a Python specific smell and large class, in that order. This research work has proposed an enhanced metric-based detection technique for Python software that analyses Python codes irrespective of its versions and extracts thresholds from good designed codes saving developers effort to calibrate threshold. It has contributed in specifying and detecting a new code smell, Improper Method Declaration and also confirmed that dynamic programming language suffers from large class, lazy class, long method and long parameter list like static languages. Lastly, this research found that code smells increases in Python programs with evolution and, lazy class and improper method declaration should be prioritized in SDK domain.


Download File

[img] Text
FSKTM 2019 55 IR.pdf

Download (1MB)

Additional Metadata

Item Type: Thesis (Masters)
Subject: Software maintenance
Subject: Python (Computer program language)
Call Number: FSKTM 2019 55
Chairman Supervisor: Norhayati Mohd Ali, PhD
Divisions: Faculty of Computer Science and Information Technology
Depositing User: Mas Norain Hashim
Date Deposited: 12 Sep 2021 13:33
Last Modified: 12 Sep 2021 13:33
URI: http://psasir.upm.edu.my/id/eprint/90722
Statistic Details: View Download Statistic

Actions (login required)

View Item View Item