Inferring Likely Mappings Between APIs Department of Computer Science Rutgers University Amruta Gokhale- Vinod Ganapathy-

Slides:



Advertisements
Similar presentations
Classification & Your Intranet: From Chaos to Control Susan Stearns Inmagic, Inc. E-Libraries E204 May, 2003.
Advertisements

LAB SESSION 7 Graphical user interface Applet fundamentals Methods in applets Execution of an applet Graphics class.
Creating a Similarity Graph from WordNet
Benjamin J. Deaver Advisor – Dr. LiGuo Huang Department of Computer Science and Engineering Southern Methodist University.
AUTOMATIC ORGANIZING AND FORMATTING FOR LECTURE NOTES SHIQING (LICIA) HE ADIVISOR: PROF.KRISTINA STRIEGNITZ SPRING 2014 STRUCTURING THE UNSTRUCTURED NOTE:
ACE: Exploiting Correlation for Energy-Efficient and Continuous Context Sensing Suman Nath Microsoft Research MobiSys 2012 Presenter: Jeffrey.
1 Dr Alexiei Dingli Introduction to Web Science Conclusion.
Building Enterprise Applications Using Visual Studio ®.NET Enterprise Architect.
SSP Re-hosting System Development: CLBM Overview and Module Recognition SSP Team Department of ECE Stevens Institute of Technology Presented by Hongbing.
UML CASE Tool. ABSTRACT Domain analysis enables identifying families of applications and capturing their terminology in order to assist and guide system.
Living in a Digital World Discovering Computers 2010.
By: Jamie McPeek. 1. Background Information 1. Metasearch 2. Sets 3. Surface Web/Deep Web 4. The Problem 5. Application Goals.
Discovering Computers Fundamentals, 2011 Edition Living in a Digital World.
The PhoneGap History Doncho Minkov Telerik Academy academy.telerik.com Technical Trainer
Technical Workshops | Esri International User Conference San Diego, California Deploying your Smartphone and Tablet Apps Eric Ito David Cardella
1.Database plan 2.Information systems plan 3.Technology plan 4.Business strategy plan 5.Enterprise analysis Which of the following serves as a road map.
Supporting the Automatic Construction of Entity Aware Search Engines Lorenzo Blanco, Valter Crescenzi, Paolo Merialdo, Paolo Papotti Dipartimento di Informatica.
Systems Analysis – Analyzing Requirements.  Analyzing requirement stage identifies user information needs and new systems requirements  IS dev team.
MobeSys Technologies MobeSys – helping you overcome mobile technology challenges.
Data-Driven Inference of API Mappings Department of Computer Science Rutgers University Amruta Gokhale- Daeyoung Kim-
Mobile App Support Jacob Poirier Geri Hengesbach Andrea Menke Erin Rossell.
Zhonghua Qu and Ovidiu Daescu December 24, 2009 University of Texas at Dallas.
ITEC224 Database Programming
Mihir Daptardar Software Engineering 577b Center for Systems and Software Engineering (CSSE) Viterbi School of Engineering 1.
Mobile Topic Maps for e-Learning John McDonald & Darina Dicheva Intelligent Information Systems Group Computer Science Department Winston-Salem State University,
 Saundra Speed  Mariela Esparza  Kevin Escalante.
Project 6 Using The Analysis ToolPak To Analyze Sales Transactions Jason C. H. Chen, Ph.D. Professor of Management Information Systems School of Business.
Introduction of Geoprocessing Topic 7a 4/10/2007.
DEPICT: DiscovEring Patterns and InteraCTions in databases A tool for testing data-intensive systems.
GoogleDictionary Paul Nepywoda Alla Rozovskaya. Goal Develop a tool for English that, given a word, will illustrate its usage.
Semantic Network as Continuous System Technical University of Košice doc. Ing. Kristína Machová, PhD. Ing. Stanislav Dvorščák WIKT 2010.
TECHONOLOGY experts INDUSTRY Some of our clients Link Translation’s extensive experience includes translation for some of the world's largest and leading.
2007. Software Engineering Laboratory, School of Computer Science S E Web-Harvest Web-Harvest: Open Source Web Data Extraction tool 이재정 Software Engineering.
Exploiting Context Analysis for Combining Multiple Entity Resolution Systems -Ramu Bandaru Zhaoqi Chen Dmitri V.kalashnikov Sharad Mehrotra.
Facilitating Document Annotation using Content and Querying Value.
Chapter 8 Evaluating Search Engine. Evaluation n Evaluation is key to building effective and efficient search engines  Measurement usually carried out.
Android absolutely dominated the number of smartphones shipped worldwide in the first three months of 2015, with.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
Basics of testing mobile apps
The way of hybrid mobile development Hybrid Mobile Applications Telerik Software Academy
OOPSLA workshop on Domain-Specific Visual Languages 1 Juha-Pekka Tolvanen, Steven Kelly, Jeff Gray, Kalle Lyytinen.
Testing Cross-Platform Mobile App Development Frameworks Nader Boushehrinejadmoradi, Vinod Ganapathy, Santosh Nagarakatte, Liviu Iftode Department of Computer.
Chapter 4 Automated Tools for Systems Development Modern Systems Analysis and Design Third Edition 4.1.
CloudJINI Technologies
Identifying “Best Bet” Web Search Results by Mining Past User Behavior Author: Eugene Agichtein, Zijian Zheng (Microsoft Research) Source: KDD2006 Reporter:
Introduction of Geoprocessing Lecture 9 3/24/2008.
1.1: Objects and Classes msklug.weebly.com. Agenda: Attendance Let’s get started What is Java? Work Time.
Discovering Computers Fundamentals, 2010 Edition Living in a Digital World.
Facilitating Document Annotation Using Content and Querying Value.
 Can access all API’s made available by OS vendor.  SDK’s are platform-specific.  Each mobile OS comes with its own unique tools and GUI toolkit.
Best 5 Mobile App Development Tools for Developer's to think beyond the Limitation.
Big Data: Every Word Managing Data Data Mining TerminologyData Collection CrowdsourcingSecurity & Validation Universal Translation Monolingual Dictionaries.
Boxes. boxes- learning targets o I will be able to display buttons (boxes) o I will be able to organize boxes o I will be able to create an animation.
HIERARCHICAL TEMPORAL MEMORY WHY CANT COMPUTERS BE MORE LIKE THE BRAIN?
A Detailed Introduction To Visual Studio.NET CRB Tech ReviewsCRB Tech Reviews introduces you to the world of Visual.
Building Enterprise Applications Using Visual Studio®
ET-570 Smart Phone Apps.
Discovering Computers 2011: Living in a Digital World Chapter 3
Objectives Overview Identify the four categories of application software Describe characteristics of a user interface Identify the key features of widely.
Modern Systems Analysis and Design Third Edition
Modern Systems Analysis and Design Third Edition
Apache Cordova Overview
Automated Pattern Based Mobile Testing
Week 01 Comp 7780 – Class Overview.
Model-Driven Analysis Frameworks for Embedded Systems
VISUAL BASIC.
Modern Systems Analysis and Design Third Edition
Modern Systems Analysis and Design Third Edition
Automating and Validating Edits
Presentation transcript:

Inferring Likely Mappings Between APIs Department of Computer Science Rutgers University Amruta Gokhale- Vinod Ganapathy- Yogesh Padmanaban- ICSE’13, the 35 th International Conference on Software Engineering San Francisco, California, May 2013

ICSE 2013Inferring Likely Mappings Between APIs1 “There is an app for that!”

ICSE 2013Inferring Likely Mappings Between APIs2 Approximately 1 million apps available on Google Play and Apple app stores

Developing a new mobile app ICSE 2013Inferring Likely Mappings Between APIs3 Your app Apple iOS

ICSE 2013Inferring Likely Mappings Between APIs4 Apple iOS Android BlackBerry 10 Windows 8 Nokia Qt Your app Challenge: Porting across platforms “Publishing an app in an enterprise today means supporting around four platforms to cover all of your employees.” Information Week Jan 2013 “Tips for Multi-Platform App Development”

Challenges in porting apps ICSE 2013Inferring Likely Mappings Between APIs5 Different SDKs for app development Different programming languages Different development environments Different debugging aids Every mobile platform exposes its own programming API Every mobile platform exposes its own programming API PlatformLanguageDevelopment Tools AndroidJavaEclipse Apple iOSObjective CXCode Windows 8C#Visual Studio

Each API has different features ICSE 2013Inferring Likely Mappings Between APIs6 Android class Android method name android.gra phics void drawRect(Rect r, Paint paint) Draws the specified Rect using specified Paint android.gra phics bool contains(int x, int y) Returns true if (x,y) is inside the rectangle. Android App Android App Android phone

iOS classiOS method name CGGeometryCGRect CGRectMake(CGFloat x, y, width, height) Returns a rectangle with the specified coordinate and size values. CGGeometrybool CGRectContainsPoint(CG Rect rect, CGPoint point) Returns whether a rectangle contains a specified point. Each API has different features ICSE 2013 Inferring Likely Mappings Between APIs7 iPhone App iPhone App

But API features often map to each other ICSE 2013Inferring Likely Mappings Between APIs8 Android class nameAndroid method name android.graphicsvoid drawRect(Rect r, Paint paint) android.graphicsbool contains(int x, int y) iOS class nameiOS method name CGGeometryCGRect CGRectMake (CGFloat x, y, width, height) CGGeometrybool CGRectContainsPoint (CGRect rect, CGPoint point) API mapping databases store target API methods that map to a source API method

Microsoft’s API mapping database ICSE 2013Inferring Likely Mappings Between APIs9 windowsphone.interoperabilitybridges.com/porting Assistance for Android, iPhone & Qt developers Help forums for developers

Nokia’s API mapping database ICSE 2013Inferring Likely Mappings Between APIs10 Use cases of apps ported to Qt Developer stories about porting developer.nokia.com/Develop/Porting/

Creating API mapping databases ICSE 2013Inferring Likely Mappings Between APIs11 Mapping databases are populated manually by domain experts Microsoft and Nokia’s app interoperability Web sites shown earlier Painstaking, error-prone and expensive –Involves reading and understanding API docs –Or crowdsourcing, asking on help forums, etc. –Hard to evolve API mapping databases as the corresponding APIs evolve

Our contribution ICSE 2013Inferring Likely Mappings Between APIs12 A methodology to automatically create API mapping databases A methodology to automatically create API mapping databases Prototyped in a tool called Rosetta –Infers mapping between Java2 Mobile Edition graphics API and Android graphics API Leverages a novel probabilistic inference approach to identify likely API mappings

What are API mappings? ICSE 2013Inferring Likely Mappings Between APIs13 Source API Target API android.graphics.drawRectCGGeometry.CGRectMake = Similar? API Mapping Yes  API mapping

How to find API mappings? ICSE 2013Inferring Likely Mappings Between APIs14 Source API Target API Consider apps with similar functionality on source and target platforms Respective developers must have exercised knowledge of source/target APIs Idea: Harvest knowledge by tracing apps

An analogy: The Rosetta Stone ICSE 2013 Ancient EgyptianAncient GreekEgyptian Inferring Likely Mappings Between APIs15 Created circa 196BC Found circa 1799AD Has same decree in 3 different scripts Known Unknown Known

An analogy: The Rosetta Stone ICSE 2013 Ancient EgyptianAncient GreekEgyptian Inferring Likely Mappings Between APIs16 Created circa 196BC Found circa 1799AD Has same decree in 3 different scripts Known

Rosetta of ICSE 2013 ICSE 2013Inferring Likely Mappings Between APIs17 Unfamiliar Familiar Source API Target API Graphics.setColor; Graphics.fillRect; … Graphics.setColor; Graphics.fillRect; … Paint.setStyle; Color.parseColor; Canvas.drawLine; … Paint.setStyle; Color.parseColor; Canvas.drawLine; … Traces under similar workloads = App corpus

Familiar Rosetta of ICSE 2013 ICSE 2013Inferring Likely Mappings Between APIs18 Familiar Source API Target API Graphics.setColor; Graphics.fillRect; … Graphics.setColor; Graphics.fillRect; … Paint.setStyle; Color.parseColor; Canvas.drawLine; … Paint.setStyle; Color.parseColor; Canvas.drawLine; … = App corpus

Why likely API mappings? Rosetta analyzes runtime traces of similar apps built for the source and target APIs Trace analysis is heuristic –Considers various artifacts of trace structure The resulting API mappings are therefore not provably semantically equivalent Instead, we associate a probability with each inferred API mapping –Signifies likelihood of mapping being true ICSE 2013Inferring Likely Mappings Between APIs19

Workflow of Rosetta ICSE 2013 Execution trace on workload 1 Execution trace on workload 1 Inferring Likely Mappings Between APIs20 PR = Probability of mapping Source method Target method PR setColorsetStyle0.60 setColorparseColor0.45 App for Source API App for Target API STEP 1 Generate execution trace STEP 2 Trace analysis STEP 3 Generate execution trace STEP 2

Combining results from multiple apps ICSE 2013 Mappings from App/Workload 1 Mappings from App/Workload N ……… Source method Target method PR setColorsetStyle0.85 setColorparseColor0.42 Final Set of Mappings Inferring Likely Mappings Between APIs21 Source method Target method PR setColorsetStyle0.60 setColorparseColor0.45 Source method Target method PR setColorsetStyle0.90 setColorparseColor0.40 Rosetta combines the mappings inferred using multiple apps and workloads pairs. See paper for details of Combining Mappings STEP 4

Find functionally similar app pairs for source and target APIs (App S, App T ) Collecting app pairs ICSE 2013Inferring Likely Mappings Between APIs22 STEP 1 App pairSource PlatformTarget Platform (Chess S, Chess T ) (TicTacToe S, TicTacToe T ) (MSweeper S, MSweeper T )

Obtain trace pairs ICSE 2013 TicTacToe S TicTacToe T Source trace 1 Target trace 1 Inferring Likely Mappings Between APIs23 Execute App S and App T on corresponding platforms with similar workloads STEP 2 Workload (1) Open game (2) Close game

Multiple traces for App S, App T ICSE 2013Inferring Likely Mappings Between APIs24 Workload nameActions performed 1.Basic 2.Click on square 3.Click on text menu Step 1Open TicTacToe game Step 2Close TicTacToe game Step 1Open TicTacToe game Step 2Click on a square Step 3Close TicTacToe game Step 1Open TicTacToe game Step 2Click on text menu option Step 3Close TicTacToe game Controlled Execution Step 1… Step 2… Execution trace STEP 2

Used in the following example Intuition: Traces under similar workloads will contain API methods that map to each other Analyze trace structure to infer these mappings Our algorithm uses four attributes of trace structure: 1.Relative frequency of method calls 2.Context of invoked methods 3.Relative positions of method calls 4.Method names Trace analysis ICSE 2013Inferring Likely Mappings Between APIs25 STEP 3

Example of trace analysis API methods or method sequences that map to each other must appear with similar relative frequency ICSE 2013Inferring Likely Mappings Between APIs26 1. Graphics.setColor; 2. Graphics.fillRect; 3. Graphics.setColor; 4. Graphics.fillRect; 5. Graphics.fillRect; 6. Graphics.fillRect; Paint.setStyle; 2. Color.parseColor; 3. Canvas.drawLine; 4. Paint.setStyle; 5. Color.parseColor; 6. Canvas.drawLine; 7. Canvas.drawLine; 8. Canvas.drawLine;... Source trace 1 Target trace 1 STEP 3

Example of trace analysis ICSE 2013Inferring Likely Mappings Between APIs27 1. Graphics.setColor; 2. Graphics.fillRect; 3. Graphics.setColor; 4. Graphics.fillRect; 5. Graphics.fillRect; 6. Graphics.fillRect; Paint.setStyle; 2. Color.parseColor; 3. Canvas.drawLine; 4. Paint.setStyle; 5. Color.parseColor; 6. Canvas.drawLine; 7. Canvas.drawLine; 8. Canvas.drawLine;... Source trace 1 Target trace 1 Source API method Raw Count Relative frequency setColor20.33 fillRect40.67 Target API method Raw Count Relative frequency setStyle20.25 parseColor20.25 drawLine40.50 STEP 3

Example of trace analysis ICSE 2013 Source method Target method Probability of mapping fillRectsetStyle fillRectparseColor fillRectdrawLine setColorsetStyle setColorparseColor setColordrawLine Inferring Likely Mappings Between APIs28 Source API method Raw Count Relative frequency setColor20.33 fillRect40.67 Target API method Raw Count Relative frequency setStyle20.25 parseColor20.25 drawLine40.50 STEP 3 Can infer the following ???????? Likely mappings, but need more evidence Large difference in relative frequencies

Example of trace analysis ICSE 2013 Source method Target method Probability of mapping fillRectsetStyle fillRectparseColor fillRectdrawLine setColorsetStyle setColorparseColor setColordrawLine Inferring Likely Mappings Between APIs29 STEP 3 ???????? Results from first trace 1. Graphics.setColor; 2. Graphics.fillRect; Canvas.drawLine; 2. Paint.setStyle; 3. Color.parseColor;... Source trace 2 Target trace 2 Using ordering of method calls: implies

Example of trace analysis ICSE 2013Inferring Likely Mappings Between APIs30 1. Graphics.setColor; 2. Graphics.fillRect; Canvas.drawLine; 2. Paint.setStyle; 3. Color.parseColor;... Source trace 2 Target trace 2 In fact, we can deduce that one of these holds: Source method Target method Probability of mapping fillRectdrawLine setColorsetStyle setColorparseColor Source method Target method Probability of mapping fillRectdrawLine setColorsetStyle setColorparseColor STEP 3

This is an example of belief propagation –If setColor likely maps to setStyle, then fillRect likely does not map to drawLine –More traces will lead to more such deductions We use factor graphs for belief propagation Using belief propagation ICSE 2013Inferring Likely Mappings Between APIs31 Source method Target method Probability of mapping fillRectdrawLine setColorsetStyle setColorparseColor Source method Target method Probability of mapping fillRectdrawLine setColorsetStyle setColorparseColor STEP 3

Combines multiple trace attributes using factor graphs to infer likely mappings Infers likely mappings between API method sequences as well –Does setColor map to setStyle  parseColor ? Associates numerical values with and based upon likelihood of mapping Detailed algorithm presented in the paper Full trace analysis algorithm ICSE 2013Inferring Likely Mappings Between APIs32 STEP 3

Output of Rosetta ICSE 2013 Source API methodTarget API methodProbability Graphics.setColorColor.parseColor0.8 Graphics.setColorPaint.setStyle0.75 Graphics.setColorCanvas.drawLine0.43 Graphics.fillRectCanvas.drawLine0.87 Graphics.fillRectColor.parseColor0.62 Graphics.fillRectPaint.setStyle0.45 Inferring Likely Mappings Between APIs33 For each source API method, a ranked list of target API methods that are likely mappings Akin to a search engine for API mappings

The Rosetta prototype Why JavaME and Android? –Both platforms use the same source language for app development –Eased development of initial prototype –But having the same source language is not a fundamental requirement for Rosetta Uses instrumentation to enable API tracing Uses Bayes Net Toolbox for factor graphs ICSE 2013Inferring Likely Mappings Between APIs34 Source platformTarget platform JavaME Graphics APIAndroid Graphics API 281 methods3837 methods

Evaluation Dataset consists of 21 app pairs for JavaME and Android, mainly board games –Controlled experiments easy with board games Traced apps manually in similar ways, and analyzed traces to infer API mappings Evaluated validity of resulting API mappings by consulting API documentation ICSE 2013Inferring Likely Mappings Between APIs35

Examples of inferred API mappings ICSE 2013Inferring Likely Mappings Between APIs36 JavaME graphics API method Android graphics API method Rank Graphics.clipRectCanvas.clipRect1 Graphics.drawCharPaint.setColor; Canvas.drawText 2 Alert.setStringTextView.setText4 Graphics.drawRectCanvas.drawRect1 Graphics.drawRectCanvas.drawLines7

Highlights of results ICSE 2013Inferring Likely Mappings Between APIs37 MetricCount 1.Distinct number of JavaME methods observed in traces 80 2.Total number of JavaME methods for which valid Android API mapping was found with rank ≤ (70%) 3.Total number of JavaME methods for which valid Android API mapping was found with rank = 1 32 (40%) I’m Feeling Lucky

Distribution of first valid mapping ICSE 2013Inferring Likely Mappings Between APIs38 Rank of first valid mapping Number of JavaME methods 56 API mappings in top ten 32 top-ranked API mappings I’m Feeling Lucky

More results in the paper Rank distribution of all valid mappings, not just the first valid one Impact of various trace attributes to overall ranking of inferred mappings Cross-validation of the results of Rosetta against an off-the-shelf JavaME to Android translator Runtime performance evaluation ICSE 2013Inferring Likely Mappings Between APIs39

Conclusion It is becoming increasingly important to port apps to a variety of platforms Key challenge: Different platforms use different programming APIs API mapping databases help, but they are created manually by domain experts ICSE 2013Inferring Likely Mappings Between APIs40 We presented a methodology to automate the creation of API mapping databases

Thank You Rosetta is part of the MOSFET RU Project Mobile Software Engineering Tools at Rutgers Google MOSFET Project Rutgers for information