FAKULTÄT FÜR INFORMATIK Leveraging Traceability Between Code and Tasks for Code Reviews and Release Management
Total Page:16
File Type:pdf, Size:1020Kb
FAKULTÄT FÜR INFORMATIK DER TECHNISCHEN UNIVERSITÄT MÜNCHEN Master’s Thesis in Informatics Leveraging Traceability between Code and Tasks for Code Reviews and Release Management Jan Finis FAKULTÄT FÜR INFORMATIK DER TECHNISCHEN UNIVERSITÄT MÜNCHEN Master’s Thesis in Informatics Leveraging Traceability between Code and Tasks for Code Reviews and Release Management Einsatz von Nachvollziehbarkeit zwischen Quellcode und Aufgaben für Code Reviews und Freigabemanagement Author: Jan Finis Supervisor: Prof. Bernd Brügge, Ph.D. Advisors: Maximilian Kögel, Nitesh Narayan Submission Date: May 18, 2011 I assure the single-handed composition of this master’s thesis only supported by declared resources. Sydney, May 10th, 2011 Jan Finis Acknowledgments First, I would like to thank my adviser Maximilian Kögel for actively supporting me with my thesis and being reachable for my frequent issues even at unusual times and even after he left the chair. Furthermore, I would like to thank him for his patience, as the surrounding conditions of my thesis, like me having an industrial internship and finishing my thesis abroad, were sometimes quite impedimental. Second, I want to thank my other adviser Nitesh Narayan for helping out after Max- imilian has left the chair. Since he did not advise me from the start, he had more effort working himself into my topic than any usual adviser being in charge of a thesis from the beginning on. Third, I want to thank the National ICT Australia for providing a workspace, Internet, and library access for me while I was finishing my thesis in Sydney. Finally, my thanks go to my supervisor Professor Bernd Brügge, Ph.D. for enabling me to write my thesis at his chair and for providing his Software Engineering book which helped me a lot during the writing of this thesis. Jan Finis - Code-to-Task Traceability for Code Reviews and Release Management vii Abstract The establishment of traceability links from source code to software engineering con- cerns like features, requirements, and tasks (the so-called code-to-concern traceability) is a challenging field of research. The approach of this thesis links tasks in the software de- velopment project to their resulting changes in the source code. In contrast, most existing approaches link other concerns, like requirements satisfied by the code, to the source code. By linking code changes to tasks, a more finely grained traceability is established. Since tasks can be linked to other concerns, this approach can also be used to establish traceabil- ity to these concerns as well. Another point which sets this work apart from previous ones is that the proposed links are maintained manually. In contrast to this, most of the existing approaches use heuristic methods to compute links. Due to their statistic nature, these approaches are rather unreli- able. Numerous processes exist which cannot deal with this unreliability and thus cannot be realized with heuristic approaches. Two of them are elaborated in this thesis. One process benefiting from the proposed links is found in the field of release manage- ment: By maintaining links between tasks and their resulting implementation, it is possible to determine which tasks are implemented in a given source code. By linking a release to a set of tasks which should be implemented for this release, the source code from which a release is to be built can be checked against these tasks. Thereby, it can be ensured that a release contains all features which are planned for it. In addition, a changelog can be generated by assembling the description of all included tasks. Ultimately, if the source code changes associated to a desired task are missing in the source code of a release, it is possible to automatically merge them into it. Another process benefiting from the proposed links is code review: When the results of a task are to be reviewed, a link to these results can be used to quickly transfer the respective changes to the reviewer’s machine. Version control systems like Subversion or Git already store the change history of a soft- ware development project. Thus, using them to establish the links is a promising approach. In this work, two different approaches using version control systems for the establishment of code-to-task links are proposed: One uses patches whereas the other one uses branches in the repository to store the set of changes to be linked to a task. The two approaches are applied to the two aforementioned processes in the fields of release management and code reviews. A tool is designed which performs the mentioned tasks. A prototype of this tool, which is integrated into the UNICASE CASE tool for Eclipse, is developed. Finally, the two approaches are compared and the prototype is evaluated. Jan Finis - Code-to-Task Traceability for Code Reviews and Release Management ix Contents 1. Introduction1 1.1. Motivation......................................1 1.2. Objective.......................................3 1.3. Related Work....................................5 1.3.1. VCS Repository Mining..........................6 1.3.2. Source Code Traceability..........................6 1.3.3. Release Management............................8 1.3.4. Code Review................................8 1.4. Scope.........................................9 1.5. Outline........................................9 2. Preliminaries 11 2.1. UNICASE ....................................... 11 2.2. Version Control Systems & Related Concepts.................. 12 2.2.1. Version Control............................... 12 2.2.2. Version Control Systems.......................... 15 2.2.3. Patches.................................... 19 2.2.4. Merging................................... 20 2.3. Popular Version Control Systems......................... 23 2.3.1. Early VCSs.................................. 24 2.3.2. Subversion.................................. 25 2.3.3. Git...................................... 26 2.3.4. Further Modern VCSs........................... 30 2.4. Change Package Representation......................... 30 2.4.1. Patches as Change Packages....................... 32 2.4.2. Lightweight Branches........................... 32 2.5. Data Dictionary................................... 34 3. Requirements Elicitation 37 3.1. Functional Requirements.............................. 37 3.1.1. Data Model Related Requirements.................... 37 3.1.2. Change Package Related Requirements................. 38 3.1.3. Repository Related Requirements.................... 39 3.1.4. Further Requirements........................... 40 3.2. Non-Functional Requirements........................... 40 3.3. Scenarios....................................... 41 3.3.1. Scenario “Project Setup”.......................... 41 3.3.2. Scenario “Development Workflow”................... 42 Jan Finis - Code-to-Task Traceability for Code Reviews and Release Management xi Contents 3.3.3. Scenario “Release Building”........................ 42 3.4. Use Cases...................................... 43 3.4.1. Use Case Setup Stream ........................... 44 3.4.2. Use Case Create Release ........................... 45 3.4.3. Use Case Assign Work Items to Release .................. 46 3.4.4. Use Case Check Release ........................... 47 3.4.5. Use Case Build Release ........................... 49 3.4.6. Use Case Resolve Conflict .......................... 51 3.4.7. Use Case Collect Changes .......................... 52 3.4.8. Use Case Assign to Work Item ....................... 53 3.4.9. Use Case Review Change Package ..................... 54 3.4.10. Use Case Commit Change Package ..................... 55 4. Requirements Analysis 57 4.1. Entity Objects.................................... 57 4.1.1. CASE Objects................................ 57 4.1.2. Revision Handling Classes........................ 59 4.1.3. Release Checking Classes......................... 60 4.2. Boundary & Control Objects............................ 60 4.2.1. Change Package Related Objects..................... 61 4.2.2. Release & Stream Setup Related Objects................. 62 4.2.3. Release Building Related Objects..................... 63 4.3. Dynamic Behaviour................................. 64 4.3.1. Release Checking.............................. 64 4.3.2. Release Building.............................. 66 5. System Design 69 5.1. Design Goals..................................... 69 5.1.1. Robustness & Reliability.......................... 69 5.1.2. Time & Manpower............................. 69 5.1.3. Adaptability................................. 70 5.1.4. Utility.................................... 70 5.1.5. Integration with Existing Systems.................... 70 5.2. Subsystem Decomposition............................. 71 5.2.1. Architecture Overview........................... 71 5.2.2. Selection of Off-The-Shelf Components................. 71 5.2.3. Subsystems................................. 72 5.2.4. Components (Plug-Ins).......................... 74 5.3. Hardware/Software Mapping........................... 75 5.4. Further System Design Decisions......................... 76 5.5. Boundary Conditions................................ 77 6. Object Design 79 6.1. The Eclipse Modelling Framework........................ 79 6.2. Adaption of the Analysis Object Model..................... 80 6.3. Extension Points................................... 82 xii Jan Finis - Code-to-Task Traceability for Code Reviews and Release Management Contents 6.4. Displaying Model Elements............................ 84 6.4.1. JFace