MultiRefactor: Automated Refactoring To Improve Software Quality

Slides:



Advertisements
Similar presentations
Local Search Algorithms
Advertisements

Annual International Conference On GIS, GPS AND Remote Sensing.
Yuri R. Tsoy, Vladimir G. Spitsyn, Department of Computer Engineering
1 An Adaptive GA for Multi Objective Flexible Manufacturing Systems A. Younes, H. Ghenniwa, S. Areibi uoguelph.ca.
A new crossover technique in Genetic Programming Janet Clegg Intelligent Systems Group Electronics Department.
Automatically Extracting and Verifying Design Patterns in Java Code James Norris Ruchika Agrawal Computer Science Department Stanford University {jcn,
D Nagesh Kumar, IIScOptimization Methods: M1L4 1 Introduction and Basic Concepts Classical and Advanced Techniques for Optimization.
1 Using Heuristic Search Techniques to Extract Design Abstractions from Source Code The Genetic and Evolutionary Computation Conference (GECCO'02). Brian.
UWECE 539 Class Project Engine Operating Parameter Optimization using Genetic Algorithm ECE 539 –Introduction to Artificial Neural Networks and Fuzzy Systems.
Ranga Rodrigo April 6, 2014 Most of the sides are from the Matlab tutorial. 1.
Genetic Algorithm.
Soft Computing Lecture 18 Foundations of genetic algorithms (GA). Using of GA.
Software Engineering Laboratory, Department of Computer Science, Graduate School of Information Science and Technology, Osaka University A Multi-Objective.
Optimization Problems - Optimization: In the real world, there are many problems (e.g. Traveling Salesman Problem, Playing Chess ) that have numerous possible.
Applying Genetic Algorithm to the Knapsack Problem Qi Su ECE 539 Spring 2001 Course Project.
FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)
Automated Patch Generation Adapted from Tevfik Bultan’s Lecture.
Kanpur Genetic Algorithms Laboratory IIT Kanpur 25, July 2006 (11:00 AM) Multi-Objective Dynamic Optimization using Evolutionary Algorithms by Udaya Bhaskara.
Genetic Algorithms What is a GA Terms and definitions Basic algorithm.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon , Tel:
Symbolic Regression via Genetic Programming AI Project #2 Biointelligence lab Cho, Dong-Yeon
SEARCH FOR DIRECT PRODUCTION OF SUPERSYMMETRIC PAIRS OF TOP QUARKS AT √ S = 8 TEV, WITH ONE LEPTON IN THE FINAL STATE. Juan Pablo Gómez Cardona PhD Candidate.
Local Search Algorithms CMPT 463. When: Tuesday, April 5 3:30PM Where: RLC 105 Team based: one, two or three people per team Languages: Python, C++ and.
Genetic Algorithm(GA)
Genetic Algorithm (Knapsack Problem)
Power Magnetic Devices: A Multi-Objective Design Approach
Introduction to Genetic Algorithms
Genetic Algorithm in TDR System
Selected Topics in CI I Genetic Programming Dr. Widodo Budiharto 2014.
Optimization Of Robot Motion Planning Using Genetic Algorithm
Multi-variable non linear function deduction using Genetic Programming
A Hierarchical Model for Object-Oriented Design Quality Assessment
Othello Artificial Intelligence With Machine Learning
Software Metrics 1.
Author :Shigeomi HARA Hiroshi DOUZONO Yoshio NOGUCHI
USING MICROBIAL GENETIC ALGORITHM TO SOLVE CARD SPLITTING PROBLEM.
Bulgarian Academy of Sciences
Rule Induction for Classification Using
Presented by: Dr Beatriz de la Iglesia
Who cares about implementation and precision?
Principles of Programming and Software Engineering
Object-Oriented Metrics
Artificial Intelligence Project 2 Genetic Algorithms
Optimization and Learning via Genetic Programming
Genetic Algorithms: A Tutorial
Multiple Aspect Modeling of the Synchronous Language Signal
Predicting Student Performance: An Application of Data Mining Methods with an Educational Web-based System FIE 2003, Boulder, Nov 2003 Behrouz Minaei-Bidgoli,
Behrouz Minaei, William Punch
Chapter 13 Quality Management
Technical Debt Reduction Using Search-Based Automated Refactoring
Aristotelis Charalampakis and Vlasis Koumousis
“Hard” Optimization Problems
Automated Patch Generation
The use of Neural Networks to schedule flow-shop with dynamic job arrival ‘A Multi-Neural Network Learning for lot Sizing and Sequencing on a Flow-Shop’
Dept. of Electrical and Computer Engineering
Methods and Materials (cont.)
EE368 Soft Computing Genetic Algorithms.
Software Metrics SAD ::: Fall 2015 Sabbir Muhammad Saleh.
Applications of Genetic Algorithms TJHSST Computer Systems Lab
M. Kezunovic (P.I.) S. S. Luo D. Ristanovic Texas A&M University
Traveling Salesman Problem by Genetic Algorithm
DESIGN OF EXPERIMENTS by R. C. Baker
Evolutionary Ensembles with Negative Correlation Learning
Beyond Classical Search
Alex Bolsoy, Jonathan Suggs, Casey Wenner
Area Coverage Problem Optimization by (local) Search
Genetic Algorithms: A Tutorial
Chapter 2: Building a System
Building a “System” Moving from writing a program to building a system. What’s the difference?! Complexity, size, complexity, size complexity Breadth.
Presentation transcript:

MultiRefactor: Automated Refactoring To Improve Software Quality Michael Mohan1 and Des Greer Queen’s University Belfast, Northern Ireland, UK 1mmohan03@qub.ac.uk

Search-Based Software Engineering mmohan03@qub.ac.uk Search-Based Software Engineering Applies search-based optimization techniques to areas of software engineering. Optimization algorithms can be used to automate aspects of software engineering to improve efficiency. Has been applied to a range of areas across the software development process e.g. project planning, software design, maintenance, testing, error removal.

Search-Based Software Maintenance mmohan03@qub.ac.uk Search-Based Software Maintenance Focuses on search-based software engineering applied to software maintenance. Involves refactoring of the software code itself to improve its structure and remove design defects. Search-based optimization algorithms can be used to refactor software and metrics can be used to inform the progress of the search. The area allows the software development process to be managed in a more agile way by reducing the time needed to maintain the code.

mmohan03@qub.ac.uk MultiRefactor A refactoring tool has been developed to automate maintenance in Java programs using search-based optimization techniques. The tool can be used for software development or for research. The tool contain 26 refactorings and 23 software metrics. MultiRefactor can be downloaded online at https://github.com/mmohan01/MultiRefactor

Refactorings Available mmohan03@qub.ac.uk Refactorings Available Field Level Method Level Class Level Increase Field Visibility Increase Method Visibility Make Class Final Decrease Field Visibility Decrease Method Visibility Make Class Non Final Make Field Final Make Method Final Make Class Abstract Make Field Non Final Make Method Non Final Make Class Concrete Make Field Static Make Method Static Extract Subclass Make Field Non Static Make Method Non Static Collapse Hierarchy Move Field Down Move Method Down Remove Class Move Field Up Move Method Up Remove Interface Remove Field Remove Method

Refactorings Available mmohan03@qub.ac.uk Refactorings Available Mostly based on Martin Fowlers1 list of refactorings. Each refactoring checks the semantics of the software code before it is applied, to make sure the relevant element can be refactored. Refactorings have been constructed using the RECODER2 framework in order to modify an abstract syntax tree that represents the elements of the code. 1 https://refactoring.com/catalog/ 2 http://recoder.sourceforge.net/doc/download.html

Metrics Available QMOOD Based Metrics CK Based Metrics Others mmohan03@qub.ac.uk Metrics Available QMOOD Based Metrics CK Based Metrics Others Class Design Size Weighted Methods Per Class Abstractness Number Of Hierarchies Number Of Children Abstract Ratio Average Number Of Ancestors Static Ratio Data Access Metric Final Ratio Direct Class Coupling Constant Ratio Cohesion Among Methods Inner Class Ratio Aggregation Referenced Methods Ratio Functional Abstraction Visibility Ratio Number Of Polymorphic Methods Lines Of Code Class Interface Size Number Of Files Number Of Methods

mmohan03@qub.ac.uk Metrics Available Metrics adapted taken from the QMOOD and CK metric suites. Other metrics also exist investigating structural aspects of the code. They can be combined to represent different configurations and can be given weights to cause differing influences on the search process. Different configurations of metrics can be used in different refactoring tasks to improve the software according to different priorities.

Search Techniques Available mmohan03@qub.ac.uk Search Techniques Available Search Type Search Variation Random Search N/A Hill Climbing Search First-Ascent Steepest-Ascent Simulated Annealing Genetic Algorithm Simple Mono-Objective GA NSGA-II NSGA-III

Search Techniques Available mmohan03@qub.ac.uk Search Techniques Available Metaheuristic algorithms have been developed for the tool using refactorings as the building blocks to enact change to the software. Three different types of genetic algorithm have been adapted for the tool: The basic algorithm uses refactorings to develop a population of solutions according to a single measure of quality. The multi-objective algorithm is adapted from NSGA-II and allows for the fitness of the solutions to be measured according to multiple different objectives. A many-objective algorithm is also available to successfully balance more than 3 objectives using the improved fitness calculations of NSGA-III.

Experimentation Experimentation was conducted with the tool to: mmohan03@qub.ac.uk Experimentation Experimentation was conducted with the tool to: Deduce useful parameter settings to use with the genetic algorithms. Test the available metrics with the genetic algorithm. Compare the mono-objective genetic approach with the multi-objective genetic approach.

mmohan03@qub.ac.uk Experimentation There are 5 different configuration parameters that can be set in the genetic algorithm. They are tested using trial and error. Each metric is tested separately with the genetic algorithm using the parameter settings deduced from the previous trial and error experiment. The metrics are split into 3 groups to test as separate objectives with the mono-objective and multi-objective algorithms.

Input Programs Used Name Lines Of Code Classes mmohan03@qub.ac.uk JSON 1.1 2,196 12 Mango 3,470 78 Beaver 0.9.11 6,493 70 Apache XML-RPC 2.0 11.616 79 JHotDraw 5.3 27,824 241

Comparison Of Parameter Settings mmohan03@qub.ac.uk Comparison Of Parameter Settings First, the crossover and mutation probabilities are compared using a baseline metric and input. Nine different configuration combinations are tested and each task is repeated 5 times. Most improved configuration is with mutation probability of 0.8 and crossover probability of 0.2.

Comparison Of Parameter Settings mmohan03@qub.ac.uk Comparison Of Parameter Settings Next, amount of generations, population size and refactoring range is tested using the mutation and crossover settings derived from before. 27 different tasks are set up. The task that gives the best balance of metric improvement and time taken to run is chosen.

Parameter Settings Used mmohan03@qub.ac.uk Parameter Settings Used Configuration Parameter Value Crossover Probability 0.2 Mutation Probability 0.8 Generations 100 Refactoring Range 50 Population Size

mmohan03@qub.ac.uk Comparison Of Metrics Each of the 23 metrics are tested separately in a genetic algorithm and the metric improvements are compared. The more successful metrics are the ones measuring lower level aspects of the code. The 18 more volatile metrics are split into 3 individual objectives to be used in a multi-objective setup, with similarly volatile metrics being grouped together. Objectives are used as examples in order to test the multi-objective genetic algorithm. Objective 1 Objective 2 Objective 3 Class Interface Size Data Access Metric Aggregation Static Ratio Direct Class Coupling Functional Abstraction Final Ratio Cohesion Among Methods Number Of Polymorphic Methods Constant Ratio Number Of Methods Abstractness Weighted Methods Per Class Inner Class Ratio Abstract Ratio Lines Of Code Referenced Methods Ratio Visibility Ratio

Comparison Of Search Approaches mmohan03@qub.ac.uk Comparison Of Search Approaches The mono-objective genetic algorithm is run 3 times with each of the objectives separately. The multi-objective algorithm is run with all 3 objectives in a combined approach. The best scores for each objective are averaged and compared across the 2 approaches. Although the mono-objective approach is better for 2 out of the 3 objectives, the multi-objective approach gives comparable scores for all 3 objectives.

Comparison Of Time Taken mmohan03@qub.ac.uk Comparison Of Time Taken The multi-objective approach takes less time than each of the three mono-objective runs. Overall, the time taken to run all of the tasks with the multi-objective approach is 58.46% less than the time taken to run all the tasks with the 3 mono-objective runs.

mmohan03@qub.ac.uk Conclusion The MultiRefactor tool can be used to refactor Java code using a variety of different methods and contains numerous refactorings. The metrics in the tool were tested with the genetic algorithm and the most useful metrics were isolated. The mono-objective genetic algorithm was compared with the multi-objective algorithm and the objective scores were found to be comparable with both approaches, with the multi-objective approach taking less time.

Opportunities For Future Work mmohan03@qub.ac.uk Opportunities For Future Work The tool can be used for further research with automated refactoring. Analysis of different refactorings and software metrics, as well as novel approaches to measuring software objectives, may provide additional assistance in the maintenance of software programs. A useful follow up to the experimentation would be to acquire the judgment of software developers on the refactored code and find out if their opinions line up with the metric analysis.

Email at: mmohan03@qub.ac.uk