Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Assessment of the Quality of Refactoring.

Slides:



Advertisements
Similar presentations
Test-Driven Development and Refactoring CPSC 315 – Programming Studio.
Advertisements

A Brief Introduction to Test- Driven Development Shawn M. Jones.
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 Extracting Code.
A Tool Support to Merge Similar Methods with a Cohesion Metric COB ○ Masakazu Ioka 1, Norihiro Yoshida 2, Tomoo Masai 1,Yoshiki Higo 1, Katsuro Inoue 1.
Refactoring Support Tool: Cancer Yoshiki Higo Osaka University.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Industrial Application.
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.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University What Kinds of.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Refactoring.
Advanced Programing practices
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University A Criterion for.
Department of Computer Science, Graduate School of Information Science and Technology, Osaka University DCCFinder: A Very- Large Scale Code Clone Analysis.
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.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 ARIES: Refactoring.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University A Multi-Objective.
Software Refactoring Part I: Introduction Bartosz Walter Advanced Object-Oriented Design Lecture 5.
Sadegh Aliakbary Sharif University of Technology Spring 2012.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University A Method to Detect License Inconsistencies for Large-
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Code-Clone Analysis.
2002/12/11PROFES20021 On software maintenance process improvement based on code clone analysis Yoshiki Higo* , Yasushi Ueda* , Toshihiro Kamiya** , Shinji.
Reishi Yokomori Nanzan University, Japan Harvey Siy University of Nebraska at Omaha, USA Norihiro Yoshida Nara Institute of Science and Technology, Japan.
Refactoring Improving the structure of existing code Refactoring1.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Detection and evolution analysis of code clones for.
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.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University How to extract.
Refactoring1 Refactoring DEPARTMENT OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING CONCORDIA UNIVERSITY February 6, 2009.
Refactoring1 Improving the structure of existing code.
Advanced Programming in Java
Agile Test-based Modeling 資工 聶順成. Outline  Introduction : Modeling meets Programming  Agile Modeling: Using Models in Agile Projects  Model-based.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Development of.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Retrieving Similar Code Fragments based on Identifier.
Software Engineering CS3003 Lecture 4 Code bad smells and refactoring.
Chapter 21 Test-Driven Development 1CS6359 Fall 2011 John Cole.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Investigation of Opportunities for Refactoring.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University July 21, 2008WODA.
Copyright © 2015 NTT DATA Corporation Kazuo Kobori, NTT DATA Corporation Makoto Matsushita, Osaka University Katsuro Inoue, Osaka University SANER2015.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Finding Code Clones.
Sadegh Aliakbary Sharif University of Technology Spring 2011.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Experience of Finding Inconsistently-Changed Bugs in Code Clones of Mobile Software Katsuro Inoue†, Yoshiki Higo†, Norihiro Yoshida†, Eunjong Choi†, Shinji.
Refactoring Mehdi Einali Advanced Programming in Java 1.
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†
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 コードクローン解析に基づくリファクタリング支援.
Refactoring1 Improving the structure of existing code.
Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Towards a Collection of Refactoring Patterns Based.
1 Gemini: Code Clone Analysis Tool †Graduate School of Engineering Science, Osaka Univ., Japan ‡ Graduate School of Information Science and Technology,
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Aries: Refactoring.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Detection of License Inconsistencies in Free and.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University A Metric-based Approach for Reconstructing Methods.
Estimating Code Size After a Complete Code-Clone Merge Buford Edwards III, Yuhao Wu, Makoto Matsushita, Katsuro Inoue 1 Graduate School of Information.
Naoya Ujihara1, Ali Ouni2, Takashi Ishio1, Katsuro Inoue1
Do Developers Focus on Severe Code Smells?
Yuta Nakamura1, Eunjong Choi1, Norihiro Yoshida2,
○Yuichi Semura1, Norihiro Yoshida2, Eunjong Choi3, Katsuro Inoue1
: Clone Refactoring Davood Mazinanian Nikolaos Tsantalis Raphael Stein
Tatsuya Miyake Takashi Ishio Katsuro Inoue
Improving the structure of existing code
Refactoring Support Tool: Cancer
Quaid-i-Azam University
Advanced Programming Behnam Hatami Fall 2017.
On Refactoring Support Based on Code Clone Dependency Relation
Advanced Programing practices
Dotri Quoc†, Kazuo Kobori†, Norihiro Yoshida
Refactoring.
Presentation transcript:

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Assessment of the Quality of Refactoring Patterns Norihiro Yoshida, Masatomo Yoshida, Katsuro Inoue Osaka University, Japan

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 2 Refactoring Refactoring is a process of restructuring an existing code.  Alter software’s internal structure without changing its external behavior  Improve the maintainability of software Example of Refactoring  Merging code clones into a new method New method Call statements

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Refactoring Pattern Typical process of restructuring existing code  Extract Method, Pull Up Method, Extract Class Each refactoring pattern includes  refactoring opportunity (bad smell) a set of code fragments that should be refactored  procedure to perform refactoring how to perform refactoring 3

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Literatures for Refactoring Patterns A lot of refactoring patterns are proposed in several literatures.  M. Fowler, Refactoring: improving the design of existing code. Addison Wesley,  M. Fowler, (93 patterns)  J. Kerievsky, Refactoring to Patterns. Addison Wesley, (27 patterns) 4 However, the quality of each refactoring pattern is mostly never assessed.

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Overview of Our Research Propose the following quality characteristics of refactoring patterns  Number of Refactoring Opportunities  Ease of Refactoring Perform a case study on assessing those quality characteristics  A case study on Introduce Polymorphic Creation with Factory Method [1] that is a kind of Pull Up Method 5 [1] J. Kerievsky, Refactoring to Patterns. Addison Wesley, 2004

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Propose Quality Characteristics of Refactoring Patterns Number of Refactoring Opportunities  What kind of refactoring opportunities are involved in software systems? Ease of Refactoring  It means that ease of applying each refactoring pattern to refactoring opportunities in source code.  We focus on “Whether or not each refactoring pattern involves enough description to perform refactoring easily”. 6

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 7 Case Study Target Refactoring Pattern (1/2) DOMBuilderTestXMLBuilderTest junit::framework::TestCase testAddAboveRoot ・・・ builder = new DOMBuilder(…); ・・・ builder = new XMLBuilder(…); ・・・ We assess the quality characteristics of Introduce Polymorphic Creation with Factory Method. Before Refactoring Condition 1 Similar methods belong to classes that have a common parent class. Condition 2 Only difference among similar methods is an object creation step.

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 8 Case Study Target Refactoring Pattern (2/2) DOMBuilderTestXMLBuilderTest testAddAboveRoot ・・・ builder = new DOMBuilder(…); ・・・ builder = new XMLBuilder(…); ・・・ AbstractBuilderTest junit::framework::TestCase createBuilder #builder: OutputBuilder testAddAboveRoot ・・・ builder = new createBuilder(“orders”); ・・・ DOMBuilderTestXMLBuilderTest Factory Method: Creator Factory Method: ConcreteCreator return new DOMBuilder(…); return new XMLBuilder(…); createBuilder Before RefactoringAfter Refactoring It’s easy to add new test class. junit::framework::TestCase We assess the quality characteristics of Introduce Polymorphic Creation with Factory Method.

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 9 Case Study Automation of Identifying Opportunities DOMBuilderTestXMLBuilderTest junit::framework::TestCase testAddAboveRoot ・・・ builder = new DOMBuilder(…); ・・・ builder = new XMLBuilder(…); ・・・ Before Refactoring Condition 1 Similar methods belong to classes that have a common parent class. Condition 2 Only difference among similar methods is an object creation step. Step 1 Detect similar methods using a code clone detection tool CCFinder Step 2 Evaluate whether detected methods include object creation statements We developed an automated tool that identifies opportunities.

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Case Study Number of Refactoring Opportunities 10 TargetLOC# classes# opportunities Target PatternPull Up Method ANTLR32K Ant198K Azureus538K jEdit168K92201 JHotDraw90K SableCC35K23701 Soot352K WALA210K Developers should inspect whether refactoring opportunities for Pull Up Method are also are also for Introduce Polymorphic Creation with Factory Method. 17.9% of the refactoring opportunities for Pull Up Method are also for Introduce Polymorphic Creation with Factory Method.

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Case Study Ease of Refactoring 1. Apply the target pattern to the refactoring opportunities in Ant and ANTLR. 2. Confirm the steps that are not described in the description of the target pattern. 11 We did not have to apply additional steps that are not described in the description of the target pattern. In terms of the ease of refactoring, the quality of the pattern presentation is enough.

Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Summary & Future Work Summary  Two quality characteristics of refactoring patterns  A case study on assessing those quality characteristics Future Work  Assess other refactoring patterns To compare refactoring patterns in terms of proposed quality characteristics  Discuss change in maintainability 12