Tatsuya Miyake Takashi Ishio Katsuro Inoue

Slides:



Advertisements
Similar presentations
COMP 121 Week 9: AbstractList and ArrayList. Objectives List common operations and properties of Lists as distinct from Collections Extend the AbstractCollection.
Advertisements

Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Identifying Source.
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Modularization.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Extraction of.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Extracting Code.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 10 Using arrays to create collections.
© 2006 Pearson Addison-Wesley. All rights reserved16-1 Iterators An iterator is an object that is used with a collection to provide sequential access to.
Identifying Crosscutting Concerns Using Fan-In Analysis MARIUS MARIN, Delft University of Technology ARIE VAN DEURSEN, Delft University of Technology and.
1 Reusability and Portability Xiaojun Qi. 2 Reuse Concepts Reuse is the use of components of one product to facilitate the development of a different.
Iterators in Java. Lecture Objectives To understand the concepts of Java iterators To understand the differences between the Iterator and ListIterator.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 10 Using arrays to create collections.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 10 Using arrays to create collections.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Measuring Copying.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Industrial Application.
OOSE 01/17 Institute of Computer Science and Information Engineering, National Cheng Kung University Member:Q 薛弘志 P 蔡文豪 F 周詩御.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Cross-application.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Debugging Support.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Mining Coding Patterns to Detect Crosscutting Concerns.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ICSE 2003 Java.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Finding Similar.
Dependency Tracking in software systems Presented by: Ashgan Fararooy.
2006/09/19AOAsia 21 Towards Locating a Functional Concern Based on a Program Slicing Technique Takashi Ishio 1,2, Ryusuke Niitani 2 and Katsuro Inoue 2.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University A Criterion for.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Investigation.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University A clone detection approach for a collection of similar.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University What Do Practitioners.
Mining and Analysis of Control Structure Variant Clones Guo Qiao.
Reishi Yokomori Nanzan University, Japan Harvey Siy University of Nebraska at Omaha, USA Norihiro Yoshida Nara Institute of Science and Technology, Japan.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Applying Clone.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Inoue Laboratory Eunjong Choi 1 Investigating Clone.
1 Context-dependent Product Line Practice for Constructing Reliable Embedded Systems Naoyasu UbayashiKyushu University, Japan Shin NakajimaNational Institute.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Retrieving Similar Code Fragments based on Identifier.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Assessment of the Quality of Refactoring.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Finding Code Clones.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Cage: A Keyword.
Chapter 8: Aspect Oriented Programming Omar Meqdadi SE 3860 Lecture 8 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
1 Measuring Similarity of Large Software System Based on Source Code Correspondence Tetsuo Yamamoto*, Makoto Matsushita**, Toshihiro Kamiya***, Katsuro.
Introduction to Data Mining by Yen-Hsien Lee Department of Information Management College of Management National Sun Yat-Sen University March 4, 2003.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Classification.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Extracting Sequence.
What kind of and how clones are refactored? A case study of three OSS projects WRT2012 June 1, Eunjong Choi†, Norihiro Yoshida‡, Katsuro Inoue†
Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Towards a Collection of Refactoring Patterns Based.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Visualization of Apriori and Association Rules n Presented By: –Manoj Wartikar –Sameer Sagade.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Software Ingredients:
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University A Metric-based Approach for Reconstructing Methods.
Introduction to OOAD and UML
The Emergent Structure of Development Tasks
Naoya Ujihara1, Ali Ouni2, Takashi Ishio1, Katsuro Inoue1
Do Developers Focus on Severe Code Smells?
FORMAL SYSTEM DEVELOPMENT METHODOLOGIES
A Pluggable Tool for Measuring Software Metrics from Source Code
Mining Application-Specific Coding Patterns for Software Maintenance
Yuta Nakamura1, Eunjong Choi1, Norihiro Yoshida2,
○Yuichi Semura1, Norihiro Yoshida2, Eunjong Choi3, Katsuro Inoue1
Boris Todorov1, Raula Gaikovina Kula2, Takashi Ishio2, Katsuro Inoue1
Towards Automatic Model Synchronization from Model Transformation
Predicting Fault-Prone Modules Based on Metrics Transitions
Refactoring Support Tool: Cancer
Quaid-i-Azam University
Recommending Verbs for Rename Method using Association Rule Mining
On Refactoring Support Based on Code Clone Dependency Relation
Review of Previous Lesson
Uml diagrams In ooad.
PADLA: A Dynamic Log Level Adapter Using Online Phase Detection
Near-Omniscient Debugging for Java Using Size-Limited Execution Trace
Presentation transcript:

Tatsuya Miyake Takashi Ishio Katsuro Inoue Towards Maintenance Support for Idiom-based Code Using Sequential Pattern Mining Tatsuya Miyake Takashi Ishio Katsuro Inoue Thank you, chair. My name is Tatsuya Miyake from Osaka university in Japan. I am talking about Towards Maintenance Support for Idiom based Code Using Sequential Pattern Mining.

Code derived from an idiom An idiom is a code fragment to implement a particular kind of concern. while (iter.hasNext()) { Item item = (Item)iter.next(); buf.append(item.toString()); } copy- and- paste reuse the idiom Data data = (Data)iter.next(); buf.append(process(data)); buf.append(data.toString()); code1 code2 code3 As a background, I talk about a code fragment derived from an idiom and a defect crosscutting modules. At first I talk about code derived from an idiom. An idiom is a code fragment to implement a particular kind of concern. For example, these three code fragments use the same iterator pattern. Code2 is a code clone of code1, a code fragment that has identical or similar code fragments to it in the source code. Code3 is a code modified after copy-and-pasted. AOASIA3 2018/11/27

A defect crosscutting modules A company reuses many idioms in a software. An idiom often spread across several systems. When a defect is found in an idiom, developers have to inspect all instances of the idiom. A similar problem is well-known in code-clone research, but code clone does not cover idioms. while (iter.hasNext()) { Item item = (Item)iter.next(); buf.append(item.toString()); } copy- and- paste reuse the idiom Data data = (Data)iter.next(); buf.append(process(data)); buf.append(data.toString()); code1 code2 code3 Next, I talk about a defect crosscutting modules. A company reuses many idioms in a software. This often leads an idiom spread across several systems. When a defect is found in an idiom, developers have to inspect all instances of the idiom. A similar problem is well-known in code-clone research, but code clone does not cover idioms. For example, when the idiom of iterator has a defect in code1, code clone detection can detect code2, but cannot detect code3 derived from code1. AOASIA3 2018/11/27

crosscutting concern code Our research goal To detect all instances of an idiom, we are planning to combine three approaches: Pattern Mining: sequential patterns Idiom-based Code Our research goal is to detect all instances of an idiom. We are planning to combine three approaches : Pattern mining, Code clone detection and aspect mining. These approaches are similar to one another because all of them detects code fragments that spread across the whole system. Now we are investigating sequential patterns. Aspect Mining: crosscutting concern code Code Clone Detection: copy-and-pasted code AOASIA3 2018/11/27

Sequential Pattern Mining sequence database Sequential pattern mining extracts frequent subsequences from a sequence database. We apply prefixspan to a sequence database extracted from Java software. A B C D E A E B C A E D F B C A D B F C I explain about our detection technique used in the preliminary case study. Sequential pattern mining is a mining method which extracts frequent subsequences from a sequence database. For example, this sequence database includes four sequences. There are subsequences “ABC” in three sequences ,subsequences “EBC” in two sequences and subsequences “DFC” in two sequences. We applied sequential pattern mining to the sequence database extracted from java software. Sequential pattern A B C ×3 E B C ×2 D F C ×2 AOASIA3 2018/11/27

Sequence Database Extraction from Java Software Sequence element of java source code Method call element IF/ELSE/END-IF element LOOP/END-LOOP element A sequence is extracted from a java method void sample () { hoge (); i = a.foo(); if( i == 0 ) { k = i; a.bar(); } Sequence Sample.hoge() A.foo() IF A.bar() END-IF Here, I explain how to extract sequence database from java software. Sequence elements of java source code are Method call, IF/ELSE/END-IF, LOOP and END-LOOP elements. A sequences is extracted from a java method. This figure is an example of extracting sequence from java source code. Element of Sequence AOASIA3 2018/11/27

Preliminary Case Study We applied sequential pattern mining to Java source code to detect idiom-based code. The target software is JHotDraw We inspected whether the instances of a pattern contribute to a single concern or not. We applied sequential pattern mining to Java source code to detect idiom-based code as preliminary case study. The target software is JHotDraw. We inspected whether the instances of a pattern contribute to a single concern or not. AOASIA3 2018/11/27

Application Specific Patterns org.jhotdraw.standard. DuplicateCommand public void execute() {   super.execute();   setUndoActivity(createUndoActivity());   FigureSelection selection = view().getFigureSele・・・   // create duplicate figure(s)   FigureEnumeration figures = (FigureEnumeration) ・・   getUndoActivity().setAffectedFigures(figures);   view().clearSelection();   ・・・・・・・・・・・・・・・・・・・・・・・・・・・・・ } setUndoActivity() createUndoActivity() getUndoActivityI() setAffectedFigures() Example of an idiom for undo Extracted from many classes, the pattern might be related to a crosscutting concern This is an example of application specific patterns. This pattern is related to undo concern of Jhotdraw. If a pattern is extracted from a number of classes, the pattern might be related to a crosscutting concern. org.jhotdraw. standard.ResizeHandle public void invokeStart(int x, int y, DrawingView view) {   setUndoActivity(createUndoActivity(view));   getUndoActivity().setAffectedFigures(new Sing ・・   ((ResizeHandle.UndoActivity)getUndoActivity()).se・・ } AOASIA3 2018/11/27

Patterns of Implementation Idioms org.jhotdraw.standard.StandardDrawingView public void addAll(Collection figures) {   FigureEnumeration fe = new FigureEnumerato・・・   while (fe.hasNextFigure()) {    add(fe.nextFigure());   } }    Sequential Pattern ( Iteration ) FigureEnumeration.hasNextFigure() while FigureEnumeration.nextFigure() } org.jhotdraw.standard.CompositeFigure public FigureEnumeration figures(Rectangle ・・・   if (_theQuadTree != null) {    ・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・     while (fe.hasNextFigure()) {       Figure f = fe.nextFigure();       //int z = fFigures.indexOf(f);       l2.add(new OrderedFigureElement(f, ・・     }     ・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・・ } This is an example of an implementation idioms. This pattern is related to iteration, but it is not an application specific pattern. In Aspect Mining Research, this kind of patterns are not interested, but useful for developers inspecting idioms. Not application specific pattern In aspect mining, this kind of pattern is not interested. Maybe useful for developers inspecting idiom AOASIA3 2018/11/27

The Difference from Code Clone Detection Tool The patterns extracted by Sequential pattern mining tool org.jhotdraw.standard.CutCommand public void execute() {   super.execute();   setUndoActivity(createUndoActivity());   FigureEnumeration fe = view().selection();   List affected = CollectionsFactory.current().createL・・・   Figure f;   FigureEnumeration dfe;   while (fe.hasNextFigure()) {     f = fe.nextFigure();     affected.add(0, f);     dfe = f.getDependendFigures();     ・・・・・・・・・・・・・・・・・・・・・   }   fe = new FigureEnumerator(affected);   getUndoActivity().setAffectedFigures(fe);   UndoActivity ua = (UndoActivity) getUndoActivity();   ua.setSelectedFigures(view().selection());   copyFigures(ua.getSelectedFigures(), ua.getSele・・・・   deleteFigures(getUndoActivity().getAffectedFigures());   view().checkDamage(); } The code extracted by code clone detection tool org.jhotdraw.fiures.GroupCommand public void execute() {   super.execute();   setUndoActivity(createUndoActivity());   getUndoActivity().setAffectedFigures(view().selection());   ((GroupCommand.UndoActivity)getUndoActivity()).group・・・   view().checkDamage(); } Here, I show the difference between code clone detention and sequential pattern mining. These method use the same pattern highlighted by red color. Code clone detection tool can detect code clone in the right two source code . However, it cannot detect the left one. Our detection technique can detect all these source code. org.jhotdraw.standard.AlignCommand public void execute() {   super.execute();   setUndoActivity(createUndoActivity());   getUndoActivity().setAffectedFigures(view().selection());   ((AlignCommand.UndoActivity)getUndoActivity()).alignA・・・   view().checkDamage(); } AOASIA3 2018/11/27

Summary Sequential pattern mining found idiom-based code Crosscutting concern Implementation Idiom Not application-specific patterns Useful information for software maintenance Combining with code clone detection is valuable The result of sequential pattern mining is different from the result of code clone detection We need further case studies on other software systems Preliminary case study shows sequential pattern mining found idiom-based code. Extracted idiom-based code includes crosscutting concerns and implementation idioms. The patterns related to an implementation idiom is also useful for software maintenance. Combining sequential pattern mining and code clone detection is valuable. Because The result of sequential pattern mining is different from the result of code clone detection. This result is limited on JhotDraw, we need further case studies on other software systems to generalize this result. AOASIA3 2018/11/27

Future Direction Combining this approach and code clone analysis detecting all code fragments derived from an original idiom Support for inspecting idiom-based code crosscutting modules. Aspect mining based on sequential pattern mining Sequential pattern mining capture an idiom that is crosscutting modules and interleaving with other code fragments Distinguishing a crosscutting concern from implementation idioms As future direction we plan combining this approach and code clone analysis to detect all code fragments derived from an original idiom. This enables developers to inspect idiom-based code crosscutting modules. Another research direction is an aspect mining based on sequential pattern mining. Sequential pattern mining can capture an idiom that is crosscutting modules and interleaving with other code fragments. Distinguishing a crosscutting concern from implementation idioms is an interesting issue in this direction. That’s all. Thank you for your attention. AOASIA3 2018/11/27

AOASIA3 2018/11/27