Abstract
dc:description.abstractModern software projects use a multitude of static analysis tools that help to improve software quality. While some static analysis tools rely on semantic analysis to detect serious programming flaws in software systems, other lightweight static analysis tools (e.g. type checkers, linters, code convention verifiers, etc.) dominantly work with syntactic information to analyze the quality of software systems. These lightweight static analysis tools can be as beneficial in improving the quality of software projects as the heavyweight static analysis tools. However, little information exists about the exact improvements brought upon by the introduction of such lightweight static analysis tools in software projects. The lack of quantified benefits of these tools can lead to software practitioners not finding value in their regular use, which can lead to a gradual decrease in the quality of software projects.In this thesis, we conduct two empirical research studies on two different modern software ecosystems to find out and quantify the software quality benefits introduced by two lightweight static analysis tools: a type checking tool called mypy, and a clone detection tool called NiCad.To quantify the usefulness of static type checkers in Python projects, we mine the issue tracking and version control repositories of 210 Python projects on GitHub. Inspired by the work of Gao et al. on type-related defects in JavaScript, we add type annotations to test whether mypy detects an error that would have helped developers to avoid real defects. We observe that close to 15% of the defects could have been prevented by mypy, suggesting that with little investment of effort, Python developers can considerably reduce the number of defects by adopting a type checker. Moreover, we find that there is no significant difference between the experience level of developers committing type-related defects and the experience level of developers committing defects that are not type-related. In addition, we observe that the redefinition of Python references causes multiple type-related defects which can easily be prevented by using a static type checker.Similarly, previous research has shown that code cloning is common in all software artefacts, and detecting and subsequently refactoring them can reduce the size and readability of the artefacts. Furthermore, regular use of clone detection tools in the development process can lead to improvements in the quality of the software. Therefore, to quantify the usefulness of clone detection in smart contracts, we analyze cloned code in a corpus of 367 smart contracts written in Solidity. We find that 33.38% of the code in smart contracts is duplicated, with a majority of the clones being exact duplicates (25.19%). This shows that smart contract developers are copying exact functions from already existing smart contracts. Since Tsantalis et al. has shown that exact clones are easily refactorable, therefore the rate of duplicated code in smart contracts can be reduced by using existing clone refactoring tools. Furthermore, our results show that there is a moderate to strong correlation between the size of the smart contract and the number of clones, suggesting that larger files can provide an ideal target for initial clone refactoring efforts. Finally, an analysis of the clone clusters reveals that most commonly cloned functions implement functionalities related to the transaction of tokens. This shows that a future domain-specific language that provides native support for safe transfer functionalities could reduce the number of cloned functions in smart contracts
Degree
thesis:*- Name thesis:degree_name
- Master of Engineering
- Grantor dc:publisher
- McGill University
- Year dc:date.issued
- 2021
Author and committee
dc:creator, dc:contributor.*- Author dc:creator
-
- Khan, Faizan
- Advisors dc:contributor.advisor
-
- McIntosh, Shane (Supervisor2)
- Varro, Daniel (Supervisor1)
Subjects
dc:subject × 1Rights
dc:rights- Statement dc:rights
-
- All items in eScholarship@McGill are protected by copyright with all rights reserved unless otherwise indicated.
- Language dc:language.iso
- en
Identifiers
dc:identifier.*- OCLC
- 1257388671
- Identifier URI
- https://hdl.handle.net/20.500.14905/100198
- Dc Identifier Other
- hyrax:9w032757f