polito.it
Politecnico di Torino (logo)

Kotlin and Android applications: diffusion and adoption of characteristic constructs

Hussein Zayat

Kotlin and Android applications: diffusion and adoption of characteristic constructs.

Rel. Luca Ardito, Marco Torchiano. Politecnico di Torino, Corso di laurea magistrale in Ingegneria Informatica (Computer Engineering), 2020

[img]
Preview
PDF (Tesi_di_laurea) - Tesi
Licenza: Creative Commons Attribution Non-commercial No Derivatives.

Download (2MB) | Preview
Abstract:

Kotlin and Android applications: diffusion and adoption of characteristic constructs Context: In October 2017, Google introduced Kotlin as a first class programming language for android applications. Kotlin is an Object oriented programming compatible with java, with the addition of some practices that helps to reduce number of code lines, exceptions and many other issues. Many mobile applications started a transition by changing the base code from java to Kotlin. Goal: The main objective of the article is to study the impact of Kotlin on open source android applications on GitHub. To analyze the impact the paper were divided into three parts. Firstly, it aims to study the interactions with Kotlin applications on GitHub(Issues,Contributors,Stars). Secondly, the usage of Kotlin practices inside applications. Finally, It aims to study the code quality on a sample set of releases. Method: First we started by fetching GitHub API's to clean repositories and collect data about applications and then download only repositories that represent applications. We defined a method that measures the percentage of adoption of Kotlin on all applications to compute the metrics needed to answer diffusion research question. Then on a set of tagged releases of the applications we measured metrics needed for the evolution research question. After that we parsed the source code of the last version of applications(Master branch on GitHub), searching Kotlin development practices using regular expression to study the usage of Kotlin features after the transition. Finally, we defined a set of code smells that are common between Kotlin and Java, and using the Lint static analysis tool provided by android studio, we calculated the Code Quality of applications on two different releases. Results: On the data-set of 33,267 open source applications, we found that 33,212 (99.9%) applications featured at least one Kotlin file, while 32,877 (98.8%) applications had a majority of Kotlin files with respect to java. 96.5% of the lines of code of all applications was written in Kotlin and 94.8% of files are ".kt" files. We found using Code Inspection that 5,022 applications (15%) are not using any of the Kotlin development practices. We considered 458 applications with tagged releases before and after October 2017 to answer the evolution research question. We found that only 19/458 featured a minority of Kotlin, While 252 releases featured majority of Kotlin with the existence of java in the production code. While the rest of releases(187) are fully converted to Kotlin. After inspecting the source code of applications searching for Kotlin development practices, we found that unsafe casting is used in 71% of applications, while safe casting is used only in 11%. Null Assertion Operator is used in 56% of the applications and safe calls are used in 70.4% of applications. Data classes and long argument lists were found respectively in 49% and 15% of the applications. Finally 54% of the applications declared variables that accept null as a value. Conclusion: A big set of apps is still in the phase of transition since Java is still used in the production code of the last release and the percentage of applications with majority of Kotlin locs over the production code is increasing. Comparing these results with the usage of Kotlin development practices, we concluded that applications made a huge transition without taking advantage of development practice.

Relatori: Luca Ardito, Marco Torchiano
Anno accademico: 2019/20
Tipo di pubblicazione: Elettronica
Numero di pagine: 75
Soggetti:
Corso di laurea: Corso di laurea magistrale in Ingegneria Informatica (Computer Engineering)
Classe di laurea: Nuovo ordinamento > Laurea magistrale > LM-32 - INGEGNERIA INFORMATICA
Aziende collaboratrici: NON SPECIFICATO
URI: http://webthesis.biblio.polito.it/id/eprint/14526
Modifica (riservato agli operatori) Modifica (riservato agli operatori)