Towards high-quality Android applications development with Kotlin - TEL - Thèses en ligne Accéder directement au contenu
Thèse Année : 2021

Towards high-quality Android applications development with Kotlin

Vers un développement d'applications Android de haute qualité avec Kotlin

Résumé

In recent years, with more than 3 million applications on its official store, Google’s Android has dominated the market of mobile operating systems worldwide. Despite this success, Google has continued evolving its operating system and its toolkits to ease application development. In 2017 Google declared Kotlin as an official Android programming language. More recently, during the Google I/O 2019, Google announced that Android became ‘Kotlin-first’, which means that new API, libraries, and documentation will target Kotlin and eventually Java and Kotlin as preferred language to create new Android applications. Kotlin is a programming language that runs on the Java Virtual Machine (JVM) and it is fully interoperable with Java because both languages are compiled to JVM bytecode. Due to this characteristic, Android developers do not need to migrate their existing applications to Kotlin to start using Kotlin in these applications. Moreover, Kotlin provides a different approach to write applications because it combines object-oriented and functional features. Therefore, we hypothesize that the adoption of Kotlin by developers may affect different aspects of Android applications’ development. However, one year after this first announcement, there were no studies in the literature about Kotlin. In this thesis, we conducted a series of empirical studies to address these lacks and build a better understanding of creating high-quality Android applications using Kotlin. First, we carried a study to measure the degree of adoption of Kotlin. Our results showed that 11% of the studied Android applications had adopted Kotlin. Then, we analyzed how the adoption of Kotlin impacted the quality of Android applications in terms of code smells. We found that the introduction of Kotlin in Android applications initially written in Java produces a rise in the quality scores from 50% to 80% according to the code smell considered. We analyzed the evolution of usage of features introduced by Kotlin, such as Smart cast, and how the amount of Kotlin code changes over applications’ evolution. We found that the number of instances of features tends to grow throughout applications’ evolution. Finally, we focused on the migration of Android applications from Java to Kotlin. We found that 25% of the open source applications that were initially written in Java have entirely migrated to Kotlin, and for 19%, the migration was done gradually, throughout several versions, thanks to the interoperability between Java and Kotlin. This migration activity is challenging because: a) each migrated piece of code must be exhaustively tested after the migration to ensure it preserves the expected behavior; b) a project can be large, composed of several candidate files to be migrated. In this thesis, we present an approach to support migration, which suggests, given a version of an application written in Java and eventually, in Kotlin, the most convenient files to migrate. We evaluated our approach’s feasibility by applying two different machine learning techniques: classification and learning-to-rank. Our results showed that both techniques modestly outperform random approaches. Nevertheless, our approach is the first that proposes the use of machine learning to recommend file-level migrations. Therefore, our results define a baseline for future work. Since the migration from Java to Kotlin may positively impact the application’s maintenance and that migration is time-consuming and challenging, developers may use our approach to select the files to be migrated first. Finally, we discuss several research perspectives opened by our results that can improve the experience of creating high-quality Android applications using Kotlin.
Android de Google domine le marché des systèmes d’exploitation mobiles dans le monde entier. Malgré ce succès, Google continue à faire évoluer son système d’exploitation et ses kits d’outils pour faciliter le développement des applications. Kotlin est le langage de programmation officiel d'Android. Il s’exécute sur la machine virtuelle Java (JVM) et il est entièrement interopérable avec Java car les deux langages sont compilés en bytecode JVM. En raison de cette caractéristique, les développeurs Android n’ont pas besoin de migrer leurs applications existantes vers Kotlin pour commencer à l’utiliser dans ces applications. De plus, il propose une approche différente pour écrire des applications car il combine des fonctionnalités orientées objet et fonctionnelles. Par conséquent, nous émettons l’hypothèse que l’adoption de Kotlin par les développeurs Android peut affecter différents aspects du développement des applications Android. Cependant, un an après cette première annonce, il n’y avait aucune étude dans la littérature sur Kotlin. Dans cette thèse, nous avons mené une série d’études empiriques pour combler ces lacunes et développer une meilleure compréhension de la création d’applications Android de haute qualité à l’aide de Kotlin. Tout d’abord, nous avons réalisé une étude pour mesurer le degré d’adoption de Kotlin. Nos résultats ont montré que 11% des applications Android étudiées avaient adopté Kotlin. Ensuite, nous avons analysé l’impact de l’adoption de Kotlin sur la qualité des applications Android en termes de défauts de code. Nous avons constaté que l’introduction du code Kotlin dans les applications Android initialement écrites en Java produit une augmentation des scores de qualité de 50% à 80% selon les défauts de code considérés. Nous avons analysé l’évolution de l’utilisation des fonctionnalités introduites par Kotlin, telles que Smart cast, et comment la quantité de code Kotlin change au fil de l’évolution des applications. Nous avons constaté que le nombre d’instances de fonctionnalités a tendance à augmenter tout au long de l’évolution des applications. Enfin, nous nous sommes concentrés sur la migration des applications Android de Java vers Kotlin. Nous avons constaté que 25% des applications open source initialement écrites en Java ont complètement migré vers Kotlin, et pour 19%, la migration s’est faite progressivement, sur plusieurs versions, grâce à l’interopérabilité entre Java et Kotlin. Cette activité de migration est difficile car : a) chaque morceau de code migré doit être testé de manière exhaustive après la migration pour s’assurer qu’il préserve le comportement attendu; b) un projet peut être énorme, composé de plusieurs dossiers candidats à migrer. Dans cette thèse, nous présentons une approche de prise en charge de la migration, qui propose, étant donné une version d’une application écrite en Java et éventuellement, en Kotlin, les fichiers les plus pratiques à migrer. Nous avons évalué la faisabilité de notre approche en appliquant deux techniques d’apprentissage automatique différentes : la classification et l’apprentissage par rang. Nos résultats ont montré que les deux techniques surpassent légèrement les approches aléatoires. Toutefois, notre approche est la première à proposer l’utilisation du machine learning pour recommander des migrations au niveau des fichiers. Par conséquent, nos résultats définissent une base de référence pour les travaux futurs. Comme la migration de Java vers Kotlin peut avoir un impact positif sur la maintenance de l’application et que la migration est longue et difficile, les développeurs peuvent utiliser notre approche pour sélectionner les fichiers à migrer en premier. Enfin, nous discutons de plusieurs perspectives de recherche ouvertes par nos résultats qui peuvent améliorer l’expérience de création d’applications Android de haute qualité à l’aide de Kotlin.
Fichier principal
Vignette du fichier
GOIS_MATEUS_Bruno2.pdf (2.11 Mo) Télécharger le fichier
Origine : Version validée par le jury (STAR)

Dates et versions

tel-03247062 , version 1 (02-06-2021)

Identifiants

  • HAL Id : tel-03247062 , version 1

Citer

Bruno Gois Mateus. Towards high-quality Android applications development with Kotlin. Mobile Computing. Université Polytechnique Hauts-de-France, 2021. English. ⟨NNT : 2021UPHF0012⟩. ⟨tel-03247062⟩
416 Consultations
944 Téléchargements

Partager

Gmail Facebook X LinkedIn More