Ranking Refactoring Suggestions based on Historical Volatility Nikolaos Tsantalis Alexander Chatzigeorgiou University of Macedonia Thessaloniki, Greece.

Slides:



Advertisements
Similar presentations
Agenda of Week V. Forecasting
Advertisements

An Example of Quant’s Task in Croatian Banking Industry
Maintenance Forecasting and Capacity Planning
Unification and Refactoring of Clones Giri Panamoottil Krishnan and Nikolaos Tsantalis Department of Computer Science & Software Engineering Clone images.
Guidelines for the application of Data Envelopment Analysis to assess evolving software Alexander Chatzigeorgiou University of Macedonia Thessaloniki,
Forecasting the Demand Those who do not remember the past are condemned to repeat it George Santayana ( ) a Spanish philosopher, essayist, poet.
Applications of Stochastic Processes in Asset Price Modeling Preetam D’Souza.
© 2012 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license.
Copyright © 2010 by Nelson Education Ltd. Chapter 7 Marketing Research, Decision Support Systems, and Sales Forecasting with Duane Weaver.
Code Smell Research: History and Future Directions Second PLOW Installment - March 5, Nikolaos Tsantalis Computer Science & Software Engineering.
Preventive Software Maintenance: The Past, the Present, the Future Nikolaos Tsantalis Computer Science & Software Engineering Consortium for Software Engineering.
CHAPTER 3 Forecasting.
Chapter 3 Forecasting McGraw-Hill/Irwin
Forecasting Demand Chapter 11. Forecasting Demand Subjective Models Delphi Method Cross-Impact Historical Analogy Causal Models Regression Models Econometric.
Lessons learned from an open-source University Project P. Basdaras, K. Chalkias, A. Chatzigeorgiou, I. Deligiannis, P. Tsakiri, N. Tsantalis Department.
Investigating the Evolution of Bad Smells in Object-Oriented Code Alexander Chatzigeorgiou Anastasios Manakos University of Macedonia Thessaloniki, Greece.
Forecasting McGraw-Hill/Irwin Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved.
Application of Graph Theory to OO Software Engineering Alexander Chatzigeorgiou, Nikolaos Tsantalis, George Stephanides Department of Applied Informatics.
Applied Business Forecasting and Planning
Business Forecasting Chapter 5 Forecasting with Smoothing Techniques.
Maintenance Forecasting and Capacity Planning
Chapter 9 – Software Evolution and Maintenance
Code smells, slice-based metrics and plenty of deodorant Code smells, slice-based metrics and plenty of deodorant Steve Counsell Brunel University Alessandro.
«Enhance of ship safety based on maintenance strategies by applying of Analytic Hierarchy Process» DAGKINIS IOANNIS, Dr. NIKITAKOS NIKITAS University of.
Funding Availability and Strategy for different types bank There is substantial variation among bank even in similar. The average small banks uses less.
Forecasting Copyright © 2015 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill.
Portfolio Management Lecture: 26 Course Code: MBF702.
A Comparison of Approaches to Investment Analysis John Favaro Proc. Fourth International Conference on Software Reuse, 1996, IEEE Computer Press, p
Operations Management
3-1Forecasting William J. Stevenson Operations Management 8 th edition.
3-1Forecasting. 3-2Forecasting FORECAST:  A statement about the future value of a variable of interest such as demand.  Forecasts affect decisions and.
Mining and Analysis of Control Structure Variant Clones Guo Qiao.
Sponsor: Dr. K.C. Chang Tony Chen Ehsan Esmaeilzadeh Ali Jarvandi Ning Lin Ryan O’Neil Spring 2010.
S14: Analytical Review and Audit Approaches. Session Objectives To define analytical review To define analytical review To explain commonly used analytical.
Holt’s exponential smoothing
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University Inoue Laboratory Eunjong Choi 1 Investigating Clone.
Forecasting Chapter 9. Copyright © 2013 Pearson Education, Inc. publishing as Prentice Hall Define Forecast.
Maintenance Workload Forecasting
Chapter 3: Software Project Management Metrics
Welcome to MM305 Unit 5 Seminar Prof Greg Forecasting.
Investment Analysis Lecture 7 Industry Analysis.
FORECASTING Kusdhianto Setiawan Gadjah Mada University.
Analytical Review and Audit Approaches
1 Predicting Classes in Need of Refactoring – An Application of Static Metrics Liming Zhao Jane Hayes 23 September 2006.
PROPRIETARY  2003 Data Research Analysis & Consultancy Solutions All Rights Reserved. This is achieved by: Improving availability / reducing stock outs.
DEPARTMENT OF MECHANICAL ENGINEERING VII-SEMESTER PRODUCTION TECHNOLOGY-II 1 CHAPTER NO.4 FORECASTING.
Copyright , Dennis J. Frailey CSE7315 – Software Project Management CSE7315 M15 - Version 9.01 SMU CSE 7315 Planning and Managing a Software Project.
CHAPTER 12 FORECASTING. THE CONCEPTS A prediction of future events used for planning purpose Supply chain success, resources planning, scheduling, capacity.
3-1Forecasting CHAPTER 3 Forecasting McGraw-Hill/Irwin Operations Management, Eighth Edition, by William J. Stevenson Copyright © 2005 by The McGraw-Hill.
3-1Forecasting William J. Stevenson Operations Management 8 th edition.
Risk management. Definition and Aim  Risk management is examine systematically all risks and react on them, taking into account all the effects of.
McGraw-Hill/Irwin Copyright © 2009 by The McGraw-Hill Companies, Inc. All Rights Reserved. Chapter 3 Forecasting.
Forecas ting Copyright © 2015 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill.
Demand Forecasting Production and Operations Management Judit Uzonyi-Kecskés Ph.D. Student Department of Management and Corporate Economics Budapest University.
Welcome to MM305 Unit 5 Seminar Dr. Bob Forecasting.
Welcome to MM305 Unit 5 Seminar Forecasting. What is forecasting? An attempt to predict the future using data. Generally an 8-step process 1.Why are you.
ISQB Software Testing Section Meeting 10 Dec 2012.
Software Metrics 1.
Forecasting Methods Dr. T. T. Kachwala.
RAJEEV GANDHI COLLEGE OF MANAGEMENT STUDIES
MultiRefactor: Automated Refactoring To Improve Software Quality
HUMAN RESOURCE GOVERNANCE, RISK MANAGEMENT AND COMPLIANCE
Object-Oriented Metrics
Capacity Planning For Products and Services
Gerald Dyer, Jr., MPH October 20, 2016
Capacity Planning For Products and Services
Exponential Smoothing
Production and Operations Management
Recommending Adaptive Changes for Framework Evolution
Capacity Planning For Products and Services
Presentation transcript:

Ranking Refactoring Suggestions based on Historical Volatility Nikolaos Tsantalis Alexander Chatzigeorgiou University of Macedonia Thessaloniki, Greece 15th European Conference on Software Maintenance and Reengineering (CSMR 2011)

Design Problems non-compliance with design principles excessive metric values lack of design patterns violations of design heuristics Fowler’s bad smells

Design Problems … can be numerous

Motivation Are all identified design problems worrying? Example: Why would it be urgent to improve a method suffering from Long Method if the method had never been changed? Need to define (quantify) the urgency to resolve a problem One possible source of information: Past code versions Underlying Philosophy: code fragments that have been subject to maintenance tasks in the past, are more likely to undergo changes → refactorings involving the corresponding code should have a higher priority.

Goal To rank refactoring suggestions based on the urgency to resolve the corresponding design problems The ranking mechanism should take into account: the number of past changes the extent of change the proximity to the current version

Inspiration

Forecasting in Financial Markets vs. Software Financial Markets Trends in volatility are more predictable than trends in prices Volatility is related to risk and general stability of markets defined as the relative rate at which prices move up and down time: trading days Software – Preventive Maintenance Risk lies in the decision to invest on resolving design problems volatility based on changes involving code affected by a smell time: successive software versions

Code Smell Volatility

Forecasting Models Random Walk (RW) Historical Average (HA) Exponential Smoothing (ES) Exponentially-Weighted Moving Average

Examined Smells Detection tool: JDeodorant Identified smells: Long Method Feature Envy State Checking

Long Method int i; int product = 1; for(i = 0; i < N; ++i) { product = product *i; } System.out.println(product); Pieces of code with large size, high complexity and low cohesion int i; int sum = 0; for(i = 0; i < N; ++i) { sum = sum + i; } System.out.println(sum);

What to look for The presence of Long Method implies that it might be difficult to maintain the method → perform refactoring if we expect that the intensity of the smell will change Previous versions: detect changes in the implementation of the method that affect the intensity of the smell change

Long Method int i; int sum = 0; int product = 1; for(i = 0; i < N; ++i) { sum = sum + i; product = product *i; } System.out.println(sum); System.out.println(product); int i; int sum = 0; int product = 1; int sumEven = 0; for(i = 0; i < N; ++i) { sum = sum + i; product = product *i; if(i%2 == 0) sumEven += i; } System.out.println(sum); System.out.println(product); System.out.println(sumEven); Version i Version i+1 Extend of Change: number of edit operations to convert method i to method i+1

Feature Envy A method is “more interested in a class other than the one it actually is in” m(Target t) { t.m1(); t.m2(); t.m3(); } m() { m1(); m2(); m3(); }

Feature Envy The Intensity of the smell is related to the number of “envied” members m(Target t) { t.m1(); t.m2(); t.m3(); } Extend of Change: variation in the number of “envied” members Version i Version i+1 envies 3 members m(Target t) { t.m1(); t.m2(); t.m3(); t.m4(); } envies 4 members

State Checking State Checking manifests itself as conditional statements that select an execution path based on the state of an object doStateA(); switch(type) { case STATE_A: break; case STATE_B: break; } doStateB();

What to look for State Checking: implies a missed opportunity for polymorphism if (state == StateA) {... } else if (state == StateB) {... } else if (state == StateC) {... } (additional statements)...

State Checking The intensity of the smell is primarily related to the number of conditional structures checking on the same states Version i Version i+1 1 cond. structure 2 cond. structures Extend of Change: variation in the number of conditional structures

Application 1.Calculate past volatility values (for each refactoring opportunity) 2.Estimate future volatility 3.Rank suggestions according to this estimate

Evaluation Goal: To compare the accuracy of the four examined models performed along two axes: direct comparison of forecast accuracy (RMSE) comparison of rankings produced by each model and according to the actual volatility Context: two open source projects JMol: 26 project versions (2004..) JFreeChart: 15 project versions (2002..)

JMol

JFreeChart

Comparison of Forecast Accuracy both consider the average of all historical values Long Method / JFreeChart

Comparison of Forecast Accuracy Random Walk is being favored by successive versions with zero volatility Peaks in RMSE when versions with zero volatility are followed by abrupt change Feature Envy / JMol

Comparison of Forecast Accuracy Random Walk Historical Average Exponential Smoothing EWMA Long Method (JFreeChart) Feature Envy (JMol) State Checking (JMol) Overall RMSE for each smell and forecasting model Simplicity and relatively good accuracy of HA  appropriate strategy for ranking refactoring suggestions HA achieves the lowest error for Long Method and Feature Envy more sophisticated models that take proximity into account do not provide higher accuracy

Ranking Comparison Forecasting models extract the anticipated smell volatility for future software evolution Therefore, estimated volatility for the last transition can be employed as ranking criterion for refactoring suggestions Evaluation: Rankings produced by each model Rankings produced by actual volatility in the last transition Compare

Ranking Comparison To compare the similarity between alternative rankings (of the same set) we used Spearman’s footrule distance ABCDEFABCDEF ABCDEFABCDEF NFr = 0 ABCDEFABCDEF FEDCBAFEDCBA NFr = 1 ABCDEFABCDEF ACBEFDACBEFD NFr = 0.333

Ranking Comparison - Spearman’s footrule (Long Method / JFreeChart) Random Walk Historical Average Exponential Smoothing EWMA Actual Random Walk Historical Average Exponential Smoothing EWMA Actual Random Walk Historical Average Exponential Smoothing EWMA Actual (Feature Envy / JMol) (State Checking / JMol) high frequency of changes low frequency of changes

Conclusions Refactoring suggestions can be ranked: according to design criteria according to past source code changes (higher priority for pieces of code that have been the subject of maintenance) Simple forecasting models, such as Historical Average lowest RMSE error similar rankings to those obtained by actual volatility (frequent changes) Future Work #1: Analyze history at a more fine-grained level Future Work #2: Combination of structural and historical criteria

Thank you for your attention 15th European Conference on Software Maintenance and Reengineering (CSMR 2011)