Reishi Yokomori Nanzan University, Japan Harvey Siy University of Nebraska at Omaha, USA Norihiro Yoshida Nara Institute of Science and Technology, Japan.

Slides:



Advertisements
Similar presentations
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Advertisements

Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
Refactoring Overview  What is refactoring?  What are four good reasons to refactor?  When should you refactor?  What is a bad smell (relative to refactoring.
Software Quality Assurance Inspection by Ross Simmerman Software developers follow a method of software quality assurance and try to eliminate bugs prior.
SERL - Software Engineering Research Labslide1 Frameworks and Hooks by Garry Froehlich Paul Sorenson SERL (Software Engineering Research Lab)
Marko Rosenmüller - University of Magdeburg, Germany 1 Feature-oriented Refactoring of Berkeley DB Dagstuhl Seminar on Software Engineering for Tailor-made.
Programming Language Paradigms: summary. Object-oriented programming Objects are the fundamental building blocks of a program. Interaction is structured.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
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.
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
Presented by IBM developer Works ibm.com/developerworks/ 2006 January – April © 2006 IBM Corporation. Making the most of Creating Eclipse plug-ins.
© Copyright Eliyahu Brutman Programming Techniques Course.
Chapter 10 Classes Continued
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University Industrial Application.
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
Introduction To System Analysis and design
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University ICSE 2003 Java.
11 1 Object oriented DB (not in book) Database Systems: Design, Implementation, & Management, 6 th Edition, Rob & Coronel Learning objectives: What.
C++ Code Analysis: an Open Architecture for the Verification of Coding Rules Paolo Tonella ITC-irst, Centro per la Ricerca Scientifica e Tecnologica
GRASP Principles. How to Design Objects The hard step: moving from analysis to design How to do it? –Design principles (Larman: “patterns”) – an attempt.
Secure Systems Research Group - FAU Aspects and mobile applications Sergio Soares Paulo Borba, “PaDA: A Pattern for Distribution Aspects” In Second Latin.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Refactoring.
Department of Computer Science, Graduate School of Information Science and Technology, Osaka University DCCFinder: A Very- Large Scale Code Clone Analysis.
A SSESSING THE I MPACT OF F RAMEWORK C HANGES U SING C OMPONENT R ANKING Reishi Yokomori Nanzan University, Japan Harvey Siy University of Nebraska at.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
Chapter 17 GRASP: Designing Objects with Responsibilities. 1CS6359 Fall 2011 John Cole.
Design Patterns. Patterns “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution.
Hyper/J and Concern Manipulation Environment. The need for AOSD tools and development environment AOSD requires a variety of tools Life cycle – support.
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.
Software Engineering Research Group, Graduate School of Engineering Science, Osaka University 1 Evaluation of a Business Application Framework Using Complexity.
Introduction CS 3358 Data Structures. What is Computer Science? Computer Science is the study of algorithms, including their  Formal and mathematical.
Methodology: The AOP Refactoring Process Aspect-Oriented Refactoring of the Apache Cocoon Shared-Object Resource Allocation System Jeff Dalton Advisor:
18 April 2005CSci 210 Spring Design Patterns 1 CSci 210.
Design Patterns Gang Qian Department of Computer Science University of Central Oklahoma.
2131 Structured System Analysis and Design By Germaine Cheung Hong Kong Computer Institute Lecture 8 (Chapter 7) MODELING SYSTEM REQUIREMENTS WITH USE.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Assessment of the Quality of Refactoring.
Refactoring. Refactoring Overview  What is refactoring?  What are four good reasons to refactor?  When should you refactor?  What is a bad smell (relative.
Software Architecture Evaluation Methodologies Presented By: Anthony Register.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University IWPSE 2003 Program.
Article Summary of The Structural Complexity of Software: An Experimental Test By Darcy, Kemerer, Slaughter and Tomayko In IEEE Transactions of Software.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Chapter 8: Aspect Oriented Programming Omar Meqdadi SE 3860 Lecture 8 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 11 Object-Oriented.
Topic 4 - Database Design Unit 1 – Database Analysis and Design Advanced Higher Information Systems St Kentigern’s Academy.
1 CSE 331 Model/View Separation and Observer Pattern slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University 1 Classification.
Review of Parnas’ Criteria for Decomposing Systems into Modules Zheng Wang, Yuan Zhang Michigan State University 04/19/2002.
SEG 4110 – Advanced Software Design and Reengineering Topic T Introduction to Refactoring.
1 Modularity Analysis of Use Case Implementations Fernanda d’Amorim Advisor: Paulo Borba.
What kind of and how clones are refactored? A case study of three OSS projects WRT2012 June 1, Eunjong Choi†, Norihiro Yoshida‡, Katsuro Inoue†
Concepts and Realization of a Diagram Editor Generator Based on Hypergraph Transformation Author: Mark Minas Presenter: Song Gu.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Object-Oriented Software Engineering Practical Software Development using UML and Java Modelling with Classes.
Implementing Distribution and Persistence Aspects with AspectJ WAS CLASS.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University A Metric-based Approach for Reconstructing Methods.
Chapter 11 Object-Oriented Design
○Yuichi Semura1, Norihiro Yoshida2, Eunjong Choi3, Katsuro Inoue1
Analysis models and design models
On Refactoring Support Based on Code Clone Dependency Relation
Dotri Quoc†, Kazuo Kobori†, Norihiro Yoshida
Refactoring.
UML  UML stands for Unified Modeling Language. It is a standard which is mainly used for creating object- oriented, meaningful documentation models for.
Refactoring the Aspectizable Interfaces: An Empirical Assessment
Presentation transcript:

Reishi Yokomori Nanzan University, Japan Harvey Siy University of Nebraska at Omaha, USA Norihiro Yoshida Nara Institute of Science and Technology, Japan Masami Noro Nanzan University, Japan Katsuro Inoue Osaka University, Japan

 Many software are maintained under a cycle of incremental development.  After each feature-addition, readability and maintainability of the software can deteriorate.  Refactoring has become one of the essential activities in development of large software systems.

 Refactoring improves software’s internal structure without changing external behavior.  Refactoring is a suite of activities for  Recovery of readability and maintainability, etc.  Preparation for future extensions.  Many approaches are suggested to perform the refactoring.

 Extracting several features from existing system into aspects.  Features implemented in a crosscutting manner would be separated from the structure of the base code.  These features are treated as aspects.  Expected results  We can manage cross-cutting code in one aspect (or in one package).  We can manage a set of such features just before building it into the structure of the base code.

 We would like to investigate that “How relationship between components changes through the aspect-oriented refactoring ?”  Q1 Is aspect-oriented refactoring effective for improving modularity and complexity?  Q2 What are the characteristics of classes likely to be strongly affected by such refactoring activities?

 Study: Refactoring projects that use AspectJ  Inputs: software written in Java.  Outputs:  Java programs as a base program  Features are extracted as aspects from the base.  Aspects that describe about the extracted features.  Code fragments and information for embedding.  We compare refactored programs against original ones from the perspective of use and clone relations.

 We would like to investigate that “How relationship between components changes through the aspect-oriented refactoring ?”  Q1 Is aspect-oriented refactoring effective for improving modularity and complexity?  Q1-1: between classes?  Q1-2: between classes and aspects?  Q2 What are the characteristics of classes likely to be strongly affected by such refactoring activities?  Q2-1: from the perspective of use relations?  Q2-2: from the perspective of clone relations?

 Use Relation (directed edge)  We used SPARS-J ‘s component registration.  Use relation is used for navigating from search result. Extracted Use Relation  inheritance,  implementation of abstract class and interface,  declaration of variables,  creation of instances,  method calls, and  class attribute references.  Clone Relation (undirected edge)

 From class A  Relations are used for understanding how the class A performs.  To class A  Relations are used for understanding how the class A is used. Class A class

 We defined use relation between class & aspect.  From class to aspect  Class A uses code defined in Aspect B  To understand A’s behavior, advices in Aspect B are necessary.  How does code in Class A spread into aspects? Class A Aspect B Weaves advices Class A Aspect B

 We defined use relation between class & aspect.  From aspect to class  Advices woven by C uses Class A.  To understand how class A is used, advices in Aspect C are necessary.  How does usage of Class A spread into aspects? Class A Aspect C Weaves advices Class A Aspect C Advice

 Use Relation (directed edge)  Clone Relation (undirected edge)  If class A and B have similar code fragments, there is a clone relation between A and B.  We detected clone relation by using CCFinder.  Similar code fragments more than 25 tokens  Advices in each aspect are also analyzed.  Clone relation between classes and aspects.

 Target Refactoring Projects  AJHotDraw  Aspectized Berkeley DB

 JHotDraw : a Java-based GUI framework for technical and structured graphics.  The AJHotDraw project was formed to identify and evaluate template-based solutions for refactoring object-oriented into aspect-oriented code.  JHotDraw6.0 → AJHotDraw Ver. 0.2, 0.3 and 0.4.

 A lot of read() & write() methods are extracted from Figure-related classes.  From a base program, some use-relations and clone-relations are extracted.  Most of extracted codes became advices in aspect.

Text Area Figure Pert Figure Clone relation Ellipse Figure Round Rectangle Figure Rectangle Figure Text Figure Image Figure Composite Figure Arrow Trip Draw Application Poly Line Figure not changed clone relation removed clone relation modified components

Text Area Figure Pert Figure Classes and Aspects Ellipse Figure Round Rectangle Figure Rectangle Figure Text Figure Persistent ImageFigure.aj Composite Figure Arrow Trip Draw Application Poly Line Figure unchanged clone relation clone between class and aspect created aspects Persistent Text Figure.aj Persistent Composite Figure.aj Image Figure

 In Ver. 0.2, there are clone relations between advices in aspects and classes in base program.  There are 37 classes that have read() & write() methods.  However, developers extracted from only 5 classes.  Clone relations between classes moved into the ones between classes and aspects.  Only a part of similar code fragments are extracted as aspect.

 Mainly, aspects superimposing an observer pattern used for notifying and handling changes in selecting figures are added.  Use relations to FigureSelectionListener are extracted.  Method call statements for its super-class are eliminated.  Manifested on 7 similar XXX-Command classes.  Clone relations are decomposed.  They were strongly connected by clone relations in ver.02.

 Features related Undo are extracted.  From several XXX-Command classes.  Inner classes about Undo are also extracted by aspects.  Clone relations existed in the Undo feature.  Undo related Use & Clone relations are extracted.  Most of extracted codes became advices.  However, clone relations exist between class and aspect.  Only 7 of 26 inner-classes are extracted.  Only a part of similar code fragments are extracted as aspect. (The same as in the case of ver.0.2.)

Original Program Connection Tool Paste Command Border Tool Text Tool JHD Drag Source Listener Select All Command not changed clone relation removed from base code modified components Un Group Command Group Command Send To Back Command Bring To Front Command Change Attribute Command Undoable Adapter Connected Text Tool Cut Command Delete Command Pert Figure Abstract Command Abstract Tool Undoable Handle Undoable Command Undoable Tool Align Command Text Area Tool Composite Figure

After refactoring Connection Tool Paste Command Border Tool Text Tool JHD Drag Source Listener Select All Command not changed clone relation removed from base code modified components Un Group Command Group Command Send To Back Command Bring To Front Command Change Attribute Command Undoable Adapter Connected Text Tool Cut Command Delete Command Pert Figure Abstract Command Abstract Tool Undoable Handle Undoable Command Undoable Tool Align Command Text Area Tool Composite Figure

Classes and Aspects Connection Tool Paste Command Undo Border Tool Text Tool JHD Drag Source Listener Select All Command Un Group Command Group Command Undo Send To Back Command Bring To Front Command Undoable Adapter Connected Text Tool Cut Command Undo Delete Command Undo Pert Figure Command Observer Abstract Tool Undoable Handle Undoable Command Undoable Tool Text Area Tool Composite Figure unchanged clone relation clone between class and aspect created aspects disappeared relation Align Command Change Attribute

 Several features are extracted to aspects.  107 aspects in 28 packages are extracted.  Java base classes and related aspects are public.  ABDB or ABDB with aspects  From publicly available versions, we select Berkeley DB Ver as an original program.  Most similar to the refactored one(ABDB).  Some packages in BDB don’t exist in ABDB.  We removed them for comparison.

 Considering only classes between BDB and ABDB.  Node(# of classes) : 331→336  Use Relation: 1977→1681 ( 15 % decrease )  Statistical analysis:  Incoming edge: BDB > ABDB  Outgoing edge: BDB > ABDB  The reduction in relations is statistically significant.  Affected classes  Outgoing edge: classes that use the extracted features  Environment, Tree, Database  Incoming edge: classes that control the extracted features  MemoryBudget, Latch, Transaction

 Considering relations from/to aspects  From class to aspect  The aspect weaves to the class.  From aspect to class  Advices in the aspect uses the class.  Statistical analysis:  Outgoing edges: BDB ≒ ABDB + edges to aspects  The center of distribution of increasing / decreasing is around 0.  The extraction seems to be done by proper number of aspects.  Incoming edges: BDB < ABDB+ edges from aspects  The center of distribution of increasing / decreasing is over 0.

 Incoming edges: BDB < ABDB+edges from aspects  Classes related with extracted feature decreases its incoming edge, even if aspect is taken into account for.  Some classes are used a lot of times in aspects.  Example : DababaseException : 81 / 107 aspects  Developers have to use an unified exception class because of constraints of AspectJ.  Example 2 : EnvironmentImpl : 60 / 107 aspects  Developers uses this for parameter passing in a lot of method calls.  Use relations to these classes are not separated clearly.  Some of them move to the created aspect.  The others still remain in the base program.

 Comparing clone relations between BDB and ABDB.  Inside of classes  Node (# of.java files) : 277 → 282  Clone Relations : 365 → 158  218 decreased, 11 newly added  Between classes and aspects: 0 → 35  We cannot find any significant clones in them.  Between aspects : 0 → 46  This refactoring was very effective from the perspective of clone removal.

 Q1-1,2: Is aspect-oriented refactoring effective for improving modularity and complexity?  A1-1: Considering only classes, aspect-refactoring decreases complexities between components.  A1-2: If edges from / to aspects are accounted for, in many cases, total complexity seems to be preserved.  We can say the same thing for AJHotDraw.  However, certain classes show drastic increase in incoming use relations.  Such classes are global resources of the system.  It arises if a scale of refactoring’s scope becomes large.  For such classes, it becomes more difficult to understand how these classes are used.

 AQ1-2: Clone relations may spread also into aspects.  In some cases, we cannot avoid the situation that produces clone relations between aspects.  For future maintenance, clone between aspects is better than clone between class and aspect.  Clone between class and aspect occurs when the scope considered for refactoring is too small.  In the case of AJHotDraw, developers interest about a scope of refactoring would be different.  Can we define minimum scope of refactoring from a distribution of clone?  The scale of the scope becomes easily too large.

 Q2:What are the characteristics of classes likely to be strongly affected by such refactoring activities?  A2-1: from the perspective of use relations.  Classes related to the extracted features  API related classes, Manager classes, Impl classes  Implementing the feature, using the feature.  A2-2: from the perspective of clone relations.  Inner-class, pre-processing or post-processing code of the extracted feature.

 AQ1: Aspect refactoring seems to be effective, however, it seems difficult to complete it.  It is hard to decide the proper scope of refactoring.  If the scale is too small, it produces clones between classes and aspects.  If the scale is defined by a distribution of clone, the scope may be too large.  Hybrid approach seems to be effective.  Use OO refactoring to decrease the number of clones.  Then use aspect refactoring to separate features implemented in a crosscutting manner.

 We examined the effectiveness of aspect-oriented refactoring with respect to changes in component relations.  Use relations  Clone relations  We applied to AJHotDraw and ABDB.  Complexity of base classes alone decreases.  Total complexity of the system seems to be almost the same.  For some classes, complexity increases.  propagation of use relations for a certain set of classes.  propagation of clone relations into aspects.

 For aspect refactoring, we need effort both to identify the proper scope of refactoring, and to make the scope as small as possible.  Aspect refactoring seems to be effective but to be difficult also; prior preparations before refactoring is important.  Collaboration between aspect refactoring experts and experts of the target system is most important.

 Application to another project.  To support generality.  To get new insights.  Further analysis to AJHotDraw and ABDB  Component Rank analysis – examine indirect relationships.  Tool for analysis  “Use relations between classes” and “clone relations” are almost automatically collected by existing systems.  Use relation related with aspects and overall comparison is done by manually.