Mining framework concepts from application code

Similar documents
StarCharter: A Tool for Mining Concept Recipes

IPM 12/13 P4 Handling Events in AWT

An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a

Abstract Classes and Interfaces

An interpreter for framework-specific modeling languages

The init() Method. Browser Calling Applet Methods

Example Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing.

GUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline

G51PRG: Introduction to Programming Second semester Applets and graphics

Programming Languages and Techniques (CIS120)

Lecture Static Methods and Variables. Static Methods

SAMPLE EXAM Exam 2 Computer Programming 230 Dr. St. John Lehman College City University of New York Thursday, 5 November 2009

CT 229 Arrays in Java

GUI 4.1 GUI GUI MouseTest.java import javax.swing.*; import java.awt.*; import java.awt.event.*; /* 1 */

GUI, Events and Applets from Applications, Part III

News! Feedback after Lecture 4! About Java and OOP!

Method Of Key Event Key Listener must implement three methods, keypressed(), keyreleased() & keytyped(). 1) keypressed() : will run whenever a key is

The first applet we shall build will ask the user how many times the die is to be tossed. The request is made by utilizing a JoptionPane input form:

CSC System Development with Java Introduction to Java Applets Budditha Hettige

Object-oriented programming in Java (2)

Java Applet & its life Cycle. By Iqtidar Ali

CS 134 Test Program #2

Recitation 02/02/07 Defining Classes and Methods. Chapter 4

Inheritance. Chapter 7. Chapter 7 1

Module 5 Applets About Applets Hierarchy of Applet Life Cycle of an Applet

CS 180 Problem Solving and Object Oriented Programming Fall 2011

Contents 8-1. Copyright (c) N. Afshartous

Java WebStart, Applets & RMI

application components

Implementing and Maintaining Microsoft SQL Server 2008 Analysis Services

Java Programming Unit 6. Inner Classes. Intro to Apples. Installing Apache Tomcat Server.

Defining Classes and Methods

Last Class: Network Overview. Today: Distributed Systems

CSCI 053. Week 5 Java is like Alice not based on Joel Adams you may want to take notes. Rhys Price Jones. Introduction to Software Development

READ AND OBSERVE THE FOLLOWING RULES:

Sun ONE Integrated Development Environment

Usage Scenarios for Feature Model Synthesis.

Java Applets. Last Time. Java Applets. Java Applets. First Java Applet. Java Applets. v We created our first Java application

DEMYSTIFYING PROGRAMMING: CHAPTER FOUR

CS211 GUI Dynamics. Announcements. Motivation/Overview. Example Revisted

Methods (Deitel chapter 6)

Module 4 Multi threaded Programming, Event Handling. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

Java Foundations John Lewis Peter DePasquale Joe Chase Third Edition

CS 120 Fall 2008 Practice Final Exam v1.0m. Name: Model Solution. True/False Section, 20 points: 10 true/false, 2 points each

Applications to Java Instruction

Introduction to Computer Science I

Basic Keywords Practice Session

GUI in Java TalentHome Solutions

Handling Mouse and Keyboard Events

Example: CharCheck. That s It??! What do you imagine happens after main() finishes?

Chapter 5 - Methods Prentice Hall, Inc. All rights reserved.

Privacy Protected Spatial Query Processing

ANNA UNIVERSITY :: CHENNAI - 25 TIME TABLE M.C.A. (DISTANCE EDUCATION) DEGREE EXAMINATIONS AUGUST - SEPTEMBER

Mergesort again. 1. Split the list into two equal parts

DCS235 Software Engineering Exercise Sheet 2 Using Java Collections

Dependencies, dependencies, dependencies

The AWT Event Model 9

PROGRAMMING LANGUAGE 2

Arrays (Deitel chapter 7)

Chapter 12 Advanced GUIs and Graphics

ISO-2022-JP (JIS ) 1 2. (Windows95/98 MacOS ) Java UNICODE UNICODE. Java. .java.java.txt native2ascii. .java

Page 1 of 7. public class EmployeeAryAppletEx extends JApplet

Mergesort again. 1. Split the list into two equal parts

Methods (Deitel chapter 6)

Which of the following syntax used to attach an input stream to console?

Chapter 13. Applets and HTML. HTML Applets. Chapter 13 Java: an Introduction to Computer Science & Programming - Walter Savitch 1

CSD Univ. of Crete Fall Java Applets

H212 Introduction to Software Systems Honors

DEMYSTIFYING PROGRAMMING: CHAPTER SIX METHODS (TOC DETAILED) CHAPTER SIX: METHODS 1

CS1004: Intro to CS in Java, Spring 2005

1. What is Jav a? simple

Chapter 4 Control Structures: Part 2

Computer Science 225 Advanced Programming Siena College Spring Topic Notes: Inheritance

Solids as point set. Solid models. Solid representation schemes (cont d) Solid representation schemes. Solid representation schemes (cont d)

8. Polymorphism and Inheritance

ASSIGNMENT NO 14. Objectives: To learn and demonstrated use of applet and swing components

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages.

Higher National Diploma in Information Technology First Year, Second Semester Examination 2015

Chapter 2 Using Objects. Types. Number Literals. A type defines a set of values and the operations that can be carried out on the values Examples:

Outline. More on the Swing API Graphics: double buffering and timers Model - View - Controller paradigm Applets

Solutions to Chapter Exercises. GUI Objects and Event-Driven Programming

MULTIMEDIA PROGRAMMING IN JAVA. Prof.Asoc. Alda Kika Department of Informatics Faculty of Natural Sciences University of Tirana

Distributed Systems. Distributed Object Systems 2 Java RMI. Java RMI. Example. Applet continued. Applet. slides2.pdf Sep 9,

Shared Collection of Java Course Materials: New Topics Covered. Agenda

CSC 1051 Algorithms and Data Structures I. Midterm Examination February 24, Name: KEY 1

Chapter 3 - Introduction to Java Applets

CS Week 15 Page 1

COMS 1003 Fall Introduction to Computer Programming in C. Bits, Boolean Logic & Discrete Math. September 13 th

2 Getting Started. Getting Started (v1.8.6) 3/5/2007

CPSC 324 Topics in Java Programming

Conditionals: More Fun with If-Then and Logic Operators

Generating Continuation Passing Style Code for the Co-op Language

CS2 Advanced Programming in Java note 8

11/19/2014. Objects. Chapter 4: Writing Classes. Classes. Writing Classes. Java Software Solutions for AP* Computer Science A 2nd Edition

Cut, Paste, Drag-and-Drop

Discovering the Power of Excel PowerPivot Data Analytic Expressions (DAX)

Tutorials. Tutorial every Friday at 11:30 AM in Toldo 204 * discuss the next lab assignment

CSC 1051 Algorithms and Data Structures I. Midterm Examination February 26, Name: Key

PLATE TECTONICS DATA VIEWER Developed by Claudia Owen and Eric Sproles

Example: Building a Java GUI

Transcription:

Mining framework concepts from application code Steven She Generative Software Developement Lab August 19, 2009 Steven She Mining framework concepts from application code 1/22

Outline 1 Introduction 2 Mining for Framework Concepts 3 Conclusions Steven She Mining framework concepts from application code 2/22

Problem - Java Applet import javaappletapplet; public class HelloApplet extends Applet { Steven She Mining framework concepts from application code 3/22

Problem - Java Applet import javaxswingjapplet; public class HelloApplet extends JApplet { Steven She Mining framework concepts from application code 3/22

Problem - Java Applet import javaxswingjapplet; public class HelloApplet extends JApplet { public void init() { showstatus("hello, world!"); Steven She Mining framework concepts from application code 3/22

Problem - Java Applet import javaxswingjapplet; import javaawteventkeylistener; public class HelloApplet extends JApplet { KeyListener keylist = new KeyListener() { public void keytyped(keyevent e) { /* Do something */ public void keypressed(keyevent e) { public void keyreleased(keyevent e) { public void init() { showstatus("hello, world!"); Steven She Mining framework concepts from application code 3/22

Problem - Java Applet import javaxswingjapplet; import javaawteventkeylistener; public class HelloApplet extends JApplet { KeyListener keylist = new KeyListener() { public void keytyped(keyevent e) { /* Do something */ public void keypressed(keyevent e) { public void keyreleased(keyevent e) { public void init() { showstatus("hello, world!"); addkeylistener(keylist); Steven She Mining framework concepts from application code 3/22

Problem - Java Applet import javaxswingjapplet; import javaawteventkeylistener; public class HelloApplet extends JApplet { KeyListener keylist = new KeyListener() { public void keytyped(keyevent e) { /* Do something */ public void keypressed(keyevent e) { public void keyreleased(keyevent e) { public void init() { showstatus("hello, world!"); addkeylistener(keylist); removekeylistener(keylist); Steven She Mining framework concepts from application code 3/22

Problem - Java Applet import javaxswingjapplet; import javaawteventkeylistener; public class HelloApplet extends JApplet { KeyListener keylist = new KeyListener() { public void keytyped(keyevent e) { /* Do something */ public void keypressed(keyevent e) { public void keyreleased(keyevent e) { public void init() { showstatus("hello, world!"); addkeylistener(keylist); public void destroy() { removekeylistener(keylist); Steven She Mining framework concepts from application code 3/22

Framework-Specific Modelling Languages Framework uses Application 0 M Antkiewicz, T Tonelli Bartolomei, K Czarnecki Steven She Mining framework concepts from application code 4/22

Framework-Specific Modelling Languages FSML formalizes Framework uses Application 0 M Antkiewicz, T Tonelli Bartolomei, K Czarnecki Steven She Mining framework concepts from application code 4/22

Framework-Specific Modelling Languages FSML formalizes Framework conforms to uses Framework-specific Model represents Application 0 M Antkiewicz, T Tonelli Bartolomei, K Czarnecki Steven She Mining framework concepts from application code 4/22

Applet FSML Applet FSML [11] name (String)![11] extendsapplet [01] extendsjapplet [0 ] registerskeylistener! 1-1 [01] asthis [01] asafield [11] listenerfield (String) [11] typedkeylistener [11] initialized [11] deregisters class name extends Applet extends JApplet calls addkeylistener( ) parameter is a field field name typed KeyListener( ) assigned an object calls removekeylistener( ) [0 ] showsstatus [11] message (String) calls showsstatus( ) parameter value Steven She Mining framework concepts from application code 5/22

Applet FSML Applet FSML [11] name (String)![11] extendsapplet [01] extendsjapplet [0 ] registerskeylistener! 1-1 [01] asthis [01] asafield [11] listenerfield (String) [11] typedkeylistener [11] initialized [11] deregisters class name extends Applet extends JApplet calls addkeylistener( ) parameter is a field field name typed KeyListener( ) assigned an object calls removekeylistener( ) [0 ] showsstatus [11] message (String) calls showsstatus( ) parameter value Steven She Mining framework concepts from application code 5/22

Forward & Reverse Model Code Applet Instance name ``HelloApplet'' extendsapplet extendsjapplet x registerskeylistener x group asthis x asafield x listenerfield (String) x typedkeylistener x initialized x deregisters x showsstatus message ``Hello, world!'' Steven She Mining framework concepts from application code 6/22

Forward & Reverse Model Code Applet Instance name ``HelloApplet'' extendsapplet extendsjapplet x registerskeylistener x group asthis x asafield x listenerfield (String) x typedkeylistener x initialized x deregisters x showsstatus message ``Hello, world!'' public class HelloApplet extends Applet { public void init() { showstatus("hello, world!"); Steven She Mining framework concepts from application code 6/22

Forward & Reverse Model Code Applet Instance name ``HelloApplet'' extendsapplet extendsjapplet x registerskeylistener x group asthis x asafield listenerfield (String) typedkeylistener initialized x deregisters x showsstatus message ``Hello, world!'' public class HelloApplet extends Applet { KeyListener keylist ; public void init() { showstatus("hello, world!"); addkeylistener(keylist); Steven She Mining framework concepts from application code 6/22

Forward & Reverse Model Code Applet Instance name ``HelloApplet'' extendsapplet extendsjapplet x registerskeylistener x group asthis x asafield listenerfield (String) typedkeylistener initialized deregisters showsstatus message ``Hello, world!'' public class HelloApplet extends Applet { KeyListener keylist = new KeyListener() { ; public void init() { showstatus("hello, world!"); addkeylistener(keylist); public void destroy() { removekeylistener(keylist); Steven She Mining framework concepts from application code 6/22

Tool Support: Forward Eng 0 H M Lee Model-guided Code Assistance for Framework Application Development Steven She Mining framework concepts from application code 7/22

Tool Support: Forward Eng (cont) 0 H M Lee Model-guided Code Assistance for Framework Application Development Steven She Mining framework concepts from application code 8/22

Tool Support: Forward Eng (cont) 0 H M Lee Model-guided Code Assistance for Framework Application Development Steven She Mining framework concepts from application code 9/22

Tool Support: Reverse Engineering 0 H M Lee Model-guided Code Assistance for Framework Application Development Steven She Mining framework concepts from application code 10/22

Constructing FSMLs FSMLs are great! But, how are they constructed? Creator must have an in-depth understanding of the framework Examine tutorials and documentation Examine boiler-plate code and example applications currently an entirely manual process Steven She Mining framework concepts from application code 11/22

Constructing FSMLs FSMLs are great! But, how are they constructed? Creator must have an in-depth understanding of the framework Examine tutorials and documentation Examine boiler-plate code and example applications currently an entirely manual process Steven She Mining framework concepts from application code 11/22

Constructing FSMLs FSMLs are great! But, how are they constructed? Creator must have an in-depth understanding of the framework Examine tutorials and documentation Examine boiler-plate code and example applications currently an entirely manual process Steven She Mining framework concepts from application code 11/22

Mining for Framework Concepts Query Provide hints for finding concept statements Slicing Find related statements Data Mining Find usage patterns among multiple examples Probabilistic Model Output a probabilistic model describing usage Steven She Mining framework concepts from application code 12/22

Input Query User selects lines of code in a framework application Steven She Mining framework concepts from application code 13/22

Concept Slicing Reduce an example to a minimal set of statements that retains the specified behaviour Source code with Query Steven She Mining framework concepts from application code 14/22

Concept Slicing Reduce an example to a minimal set of statements that retains the specified behaviour Source code with Query Program Slicer Steven She Mining framework concepts from application code 14/22

Concept Slicing Reduce an example to a minimal set of statements that retains the specified behaviour Source code with Query Program Slicer Relevant Statements Steven She Mining framework concepts from application code 14/22

Concept Slicing public class HelloApplet extends JApplet { KeyListener keylist = new KeyListener() { Image smiley; public void init() { smiley = getimage(getcodebase(), "images/smilegif"); showstatus("hello, world!"); addkeylistener(keylist); play(getcodebase(), "audio/woohoowav"); public void destroy() { removekeylistener(keylist); Steven She Mining framework concepts from application code 15/22

Concept Slicing public class HelloApplet extends JApplet { KeyListener keylist = new KeyListener() { Image smiley; public void init() { smiley = getimage(getcodebase(), "images/smilegif"); showstatus("hello, world!"); addkeylistener(keylist); play(getcodebase(), "audio/woohoowav"); public void destroy() { removekeylistener(keylist); Steven She Mining framework concepts from application code 15/22

Sliced Statements Example Location Statement HelloApplet Class field:keylist (KeyListener) HelloApplet initializer assigns:keylist = new KeyListener() HelloApplet init() calls:addkeylistener(keylist) HelloApplet destroy() calls:removekeylistener(keylist) Steven She Mining framework concepts from application code 16/22

Finding Related Usages Steven She Mining framework concepts from application code 17/22

Reverse-Engineering the Model Events 1 Events 2 Events 3 Events 4 Sliced Events Steven She Mining framework concepts from application code 18/22

Reverse-Engineering the Model Events 1 Events 2 Events 3 Events 4 Sliced Events Data Miner Steven She Mining framework concepts from application code 18/22

Reverse-Engineering the Model Events 1 Events 2 Events 3 Events 4 Sliced Events Data Miner Probabilistic Model Steven She Mining framework concepts from application code 18/22

Feature Model Mining Mine for probabilistic expressions from slices gathered from multiple applications 0 K Czarnecki, A Wasowski, S She Steven She Mining framework concepts from application code 19/22

Feature Model Mining Mine for probabilistic expressions from slices gathered from multiple applications Association Rule conf KeyListener asthis asafield 100% 0 K Czarnecki, A Wasowski, S She Steven She Mining framework concepts from application code 19/22

Feature Model Mining Mine for probabilistic expressions from slices gathered from multiple applications Association Rule conf KeyListener asthis asafield 100% asafield asthis 100% 0 K Czarnecki, A Wasowski, S She Steven She Mining framework concepts from application code 19/22

Feature Model Mining Mine for probabilistic expressions from slices gathered from multiple applications Association Rule conf KeyListener asthis asafield 100% asafield asthis 100% KeyListener asafield 70% KeyListener asthis 30% 0 K Czarnecki, A Wasowski, S She Steven She Mining framework concepts from application code 19/22

Feature Model Mining Mine for probabilistic expressions from slices gathered from multiple applications Association Rule conf KeyListener asthis asafield 100% asafield asthis 100% KeyListener asafield 70% KeyListener asthis 30% asafield new KeyListener() 100% 0 K Czarnecki, A Wasowski, S She Steven She Mining framework concepts from application code 19/22

Mined Feature Model KeyListener asthis 30% asafield 70% calls:addkeylistener() new KeyListener() calls:removekeylistnr() 80% this field this field 30% 70% 25% 75% Steven She Mining framework concepts from application code 20/22

Framework-Specific Modelling Languages FSML formalizes Framework conforms to uses Framework-specific Model represents Application 0 M Antkiewicz, T Tonelli Bartolomei, K Czarnecki Steven She Mining framework concepts from application code 21/22

Conclusions Query Concept Slicing Data Mining Probabilistic Model Constructs a recipe from a set of examples Slicing finds related statements given a query Data mining finds patterns in sliced statements to form a probabilistic model Steven She Mining framework concepts from application code 22/22