Loading [a11y]/accessibility-menu.js
Mapping API Elements for Code Migration with Vector Representations | IEEE Conference Publication | IEEE Xplore

Mapping API Elements for Code Migration with Vector Representations


Abstract:

Mapping API elements has a significant role in software development, especially in code migration. A manual process of defining the migration is tedious and error-prone w...Show More

Abstract:

Mapping API elements has a significant role in software development, especially in code migration. A manual process of defining the migration is tedious and error-prone while recent approaches to automatically mine API mappings are limited to discover the mappings with textually similar APIs’ names. This leads to the low accuracy in existing migration tools.We propose an approach to automatically mine API mappings which overcomes the lexical mismatch problem. We represent an API by its usages instead of its name.To characterize an API with its context consisting of surrounding APIs in its usages, we take advantage of Word2Vec model to project the APIs of Java JDK and C# .NET into corresponding continuous vector spaces. The semantic relations among APIs will be observed in those continuous space as the geometric arrangements between their representation vectors in two vector spaces.We use a learning approach to derive the linear (e.g., rotating and scaling) transformation function between two vector spaces. Transformation function is trained from human-defined pairs of API mappings from Java to C#. To find the C# API mapping with a given Java API, we use the learned function to compute its transformed vector in the C# vector space. Then, the C# API which has the most similar vector with the transformed vector is considered as the result. Our experiment shows that for just one suggestion, we are able to correctly derive the API in C# in almost 43% of the cases. With 5 suggestions, we can correctly suggest the correct C# API in almost 3 out of 4 cases (73.2%).
Date of Conference: 14-22 May 2016
Date Added to IEEE Xplore: 23 March 2017
ISBN Information:
Conference Location: Austin, TX, USA
ECpE Department, Iowa State University, USA
ECpE Department, Iowa State University, USA
ECpE Department, Iowa State University, USA

1. Introduction

Problem. Code migration between languages is challenging partly because different languages require developers to use different software libraries and frameworks. For example, in Java, Java Development Kit library (JDK) is a popular toolkit while. NET is the main framework used in C# software development. Code migration requires not only the mappings between the language constructs (e.g., statements, expressions) but also the mappings among the APIs of the libraries/frameworks used in two languages. For example, in Java, to write to a file, one can use FileWriter.write of FileWriter, and in C#, one can achieve the same function with StreamWriter. Write of StreamWriter. Such mapping is called API mapping.

ECpE Department, Iowa State University, USA
ECpE Department, Iowa State University, USA
ECpE Department, Iowa State University, USA

Contact IEEE to Subscribe

References

References is not available for this document.