Cloning Beyond Source Code : a Study of the Practices in API Documentation and Infrastructure As Code
Total Page:16
File Type:pdf, Size:1020Kb
Cloning beyond source code : a study of the practices in API documentation and infrastructure as code. Mohamed Ameziane Oumaziz To cite this version: Mohamed Ameziane Oumaziz. Cloning beyond source code : a study of the practices in API docu- mentation and infrastructure as code.. Software Engineering [cs.SE]. Université de Bordeaux, 2020. English. NNT : 2020BORD0007. tel-02879899 HAL Id: tel-02879899 https://tel.archives-ouvertes.fr/tel-02879899 Submitted on 24 Jun 2020 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. ACADÉMIEDE BORDEAUX U NIVERSITÉ D E B ORDEAUX Sciences et Technologies THÈSE Présentée au Laboratoire Bordelais de Recherche en Informatique pour obtenir le grade de Docteur de l’Université de Bordeaux Spécialité : Informatique Formation Doctorale : Informatique École Doctorale : Mathématiques et Informatique Cloning beyond source code: a study of the practices in API documentation and infrastructure as code par Mohamed Ameziane OUMAZIZ Soutenue le 27 Janvier 2020, devant le jury composé de : Président du jury Jean-Philippe DOMENGER, Professeur. Université de Bordeaux, France Directeur de thèse Jean-Rémy FALLERI, Maître de conférences, HDR . Bordeaux INP,France Co-Directeur de thèse Xavier BLANC, Professeur. Université de Bordeaux, France Rapporteurs Mireille BLAY-FORNARINO, Professeur . Université de Nice, France Tom MENS, Professeur. Université de Mons, Belgique Examinateurs Anne ETIEN, Maître de conférences, HDR. Université Lille 1, France Tewfik ZIADI, Maître de conférences, HDR. Sorbonne Université, France Abstract When developing software, maintenance and evolution represents an important part of the de- velopment life-cycle, representing up to 80% of the overall cost and effort. During the maintenance effort, developers sometimes copy and paste source code fragments in order to reuse them. Such practice, seemingly harmless, is more frequent than we expect. Commonly referred to as “clones” in the literature, these source code duplicates are a well-known and well studied topic in software engineering. In this thesis, we aim at shedding light on copy-paste practices on software artifacts beyond source code. In particular, we chose to focus our contributions on two specific types of software artifacts: API documentation and deployment files (i.e. Dockerfiles) as they respectively: help de- velopers understand how to use and integrate external APIs, and represent the last step between developers and application users. For each software artifact, we follow a common empirical study methodology. As a result, we show that API documentations and software deployment files (i.e. Dockerfiles) contain duplicates and that such duplicates are frequent from 27,69% (API documen- tation) to nearly 50% (Dockerfiles). We then identify the reasons behind the existence of such du- plicates. Also, we perform a survey on experimented developers and find that they’re aware of such duplicates, frequently face them. But still have a mixed opinion regarding them. Finally, we show that both types of software artifacts are lacking tools with reuse mechanisms to cope with dupli- cates, and that some developers even resort to ad-hoc tools to manage them. Keywords: Documentation, duplicates, Dockerfile, Docker, reuse Résumé Lors du développement de logiciels, la maintenance et l’évolution constituent une partie im- portante du cycle de vie du développement représentant 80% du coût et des efforts globaux. Pen- dant l’effort de maintenance, les développeurs copient et collent parfois des fragments de code source afin de les réutiliser. Une telle pratique, apparemment inoffensive, est plus fréquente qu’on ne le pense. Communément appelés “clones” dans la littérature, ces doublons de code source sont un sujet bien connu et étudié en génie logiciel. Dans cette thèse, nous visons à mettre en lumière les pratiques du copier-coller sur les arte- facts logiciels au-delà du code. En particulier, nous avons choisi de concentrer nos contributions sur deux types d’artefacts logiciels : Documentation d’API et fichiers de déploiement (c.-à-d. Do- ckerfiles) puisqu’ils respectivement : aident les développeurs à comprendre comment utiliser et intégrer des API externes, et représentent la dernière étape entre les développeurs et les utilisateurs d’une application. Pour chaque artefact logiciel, nous suivons une méthodologie d’étude empi- rique commune. Comme résultats, nous montrons que les documentations d’API et les fichiers de déploiement de logiciels (c.-à-d. Dockerfiles) sont confrontés aux doublons et que de tels doublons sont fréquents allant de 27,69% (documentation API) à presque 50% (Dockerfiles). Par la suite, nous identifions les raisons derrière l’existence de ces doublons. Aussi, nous effectuons une enquête auprès de développeurs expérimentés et de constatons qu’ils sont conscients de ces doublons, et qu’ils les rencontrent souvent tout en ayant un avis mitigé sur eux. Enfin, nous montrons que les deux artefacts logiciels manquent de mécanismes de réutilisation pour faire face aux doublons, et que certains développeurs ont même recours à des outils ad-hoc pour les gérer. Mots clés : Documentation, duplication, Dockerfile, Docker, reutilisation LaBRI — 351, Cours de la Libération — 33400 Talence — France Contents 1 Introduction1 1.1 Context ........................................ 2 1.2 Problem statement ................................. 3 1.3 Methodology..................................... 5 1.4 Contributions .................................... 6 1.5 Thesis outline..................................... 7 2 Background9 2.1 Context ........................................ 10 2.1.1 Clone definitions.............................. 10 2.1.2 Clone detection approaches ....................... 14 2.2 Empirical research on clones in software artifacts beyond code . 21 2.3 Clone management................................. 28 2.4 Summary....................................... 30 3 Duplicates in API documentation 33 3.1 Introduction ..................................... 34 3.2 Background...................................... 35 3.3 Data collection.................................... 37 3.3.1 Repositories................................. 38 3.3.2 Survey .................................... 39 3.3.3 Duplicates detection tool......................... 40 3.4 Contributions .................................... 41 3.4.1 RQ1: Do developers often resort to copy-paste documentation tags? 42 3.4.2 RQ2: What are the causes of documentation tags copy-paste? . 44 i ii CONTENTS 3.4.3 RQ3: Could duplicate documentation be avoided by a proper us- age of documentation tools? ....................... 50 3.5 Threats to validity.................................. 52 3.6 Conclusion...................................... 53 4 Duplicates in Dockerfiles 55 4.1 Introduction ..................................... 56 4.2 Background...................................... 57 4.3 Data collection.................................... 60 4.3.1 Repositories................................. 60 4.3.2 Survey .................................... 61 4.3.3 Duplicates detection tool......................... 62 4.4 Contributions .................................... 64 4.4.1 RQ1: Do official projects maintain families of Dockerfiles, and why? 64 4.4.2 RQ2: Do duplicates arise in Dockerfiles families and why? . 66 4.4.3 RQ3: What are the pros and cons of tools used by experts to man- age Dockerfiles?............................... 72 4.5 Threats to validity.................................. 77 4.6 Conclusion...................................... 79 5 Conclusion 81 5.1 Summary of contributions............................. 81 5.1.1 Duplicates in API documentation .................... 81 5.1.2 Duplicates in Dockerfiles ......................... 82 5.2 Perspectives and discussion............................ 83 5.2.1 Duplicates in API documentation .................... 83 5.2.2 Duplicates in Dockerfiles ......................... 84 5.2.3 Discussion.................................. 84 A Résumé en Français 87 List of Figures 101 List of Tables 103 CHAPTER 1 Introduction Through this chapter, we introduce the context, motivation and contributions of this thesis. This thesis aims at empirically studying duplicates among two types of soft- ware artifacts. We first start by taking a closer look towards duplicates in API docu- mentation for two programming languages: Java and Ruby. We then tackle another duplicates issue plaguing Dockerfiles. in this chapter, we describe these two under- lying challenges and our main contributions. Contents 1.1 Context...................................... 2 1.2 Problem statement............................... 3 1.3 Methodology.................................. 5 1.4 Contributions.................................. 6 1.5 Thesis outline.................................. 7 1 2 CHAPTER 1. INTRODUCTION 1.1 Context When developing a software, maintenance and evolution represents an important part of the development’s life-cycle, making up to 80% of the overall cost and effort [Alkhatib, 1992]. During the development or