Not logged in.

Contribution Details

Type Bachelor's Thesis
Scope Discipline-based scholarship
Title Suggesting Meaningful Method Names
Other Titles Analysing Source Code using Deep Learning Techniques
Organization Unit
Authors
  • Yves Rutishauser
Supervisors
  • Adelina Ciurumelea
Language
  • English
Institution University of Zurich
Faculty Faculty of Business, Economics and Informatics
Number of Pages 56
Date 2019
Abstract Text Good identifier names provide a high-level summary of source code and are therefore beneficial during software maintenance. Hence, automatically suggesting descriptive and accurate method names reduces time spent maintaining code and improves understandability and readability of software corpora. Since source code has many similar properties to natural language many models originally developed for Natural Language Processing (NLP) are successfully applied to code. In this thesis, I propose 2 different approaches and experiment with a total of 6 models that are specifically adjusted to solve the method naming problem. These models learn to assign tokens to locations (embeddings) such that tokens with similar meanings have similar embeddings. Based on the combination of these embeddings, I can suggest accurate method names. I demonstrate that models are more effective if partially trained on the current project than models that predict on projects completely unobserved during training. Furthermore, I show the effectiveness of splitting a method name into sub-tokens. These models can predict neologisms (names that are not in the vocabulary). In a quantitative analysis, I compare the different models and approaches with different metrics. I furthermore adapt a metric, which is specifically designed for this task and has been used in the past. Additionally, I evaluate the models with different input parameters and show the effectiveness of using the type, parameters, and the method body to suggest its name. In a qualitative analysis, I discuss 8 different use cases, demonstrate visualizations and show the limits of the proposed models. The code and data are available on Github [12] and Zenondo [56].
Zusammenfassung Gute Identifier-Namen bieten eine kurze Zusammenfassung des Quellcodes und sind daher bei der Softwarewartung von Vorteil. Das automatische Vorschlagen von deskriptiven und akkuraten Methodennamen reduziert den Zeitaufwand der Codepflege und verbessert die Verständlichkeit und Lesbarkeit von Software. Da der Quellcode viele ähnliche Eigenschaften wie die natürliche Sprache aufweist, werden viele ursprünglich für Natural Language Processing (NLP) entwickelten Modelle erfolgreich auf Software angewendet. In dieser Arbeit schlage ich 2 verschiedene Ansätze vor und experimentiere mit insgesamt 6 Modellen, die speziell angepasst sind, um Methodennamen vorzuschlagen. Diese Modelle lernen, sogenannte Tokens an Locations (Embeddings) so zuzuordnen, dass Tokens mit ähnlicher Bedeutung ähnliche Embeddings haben. Basierend auf der Kombination dieser Embeddings kann ich akkurate Methodennamen vorschlagen. Ich zeige, dass Modelle effektiver sind, wenn sie teilweise auf dem aktuellen Projekt trainiert worden sind, als Modelle, die bei Projekten vorhersagen, die während des Trainings unbeobachtet bleiben. Darüber hinaus zeige ich die Effektivität der Aufteilung eines Methodennamens in sogenannte Sub-Tokens auf. Diese Modelle können Neologismen vorhersagen (Namen, die nicht im Vokabular enthalten sind). In einer quantitativen Analyse vergleiche ich die verschiedenen Modelle und Ansätze mit unterschiedlichen Messgrößen. Außerdem adaptiere ich eine Metrik, die speziell für diese Aufgabe entwickelt wurde und in der Vergangenheit verwendet wurde. Zusätzlich bewerte ich die Modelle mit verschiedenen Inputparametern und zeige die Effektivität der Verwendung des Typs, der Parameter und des Methodeninhalts, um den entsprechenden Namen vorzuschlagen. In einer qualitativen Analyse liste ich 8 verschiedene Anwendungsfälle auf, demonstriere Visualisierungen und zeige die Grenzen der vorgeschlagenen Modelle auf. Der Code und die Daten sind auf Github [12] und Zenondo [56] verfügbar.
PDF File Download
Export BibTeX