Coder Social home page Coder Social logo

refgen's Introduction

README

RefGen Eclipse plug-in

(c) Copyright 2017 Rodrigo Morales Alvarado

  • Ecole Polytechinique Montreal.
  • Use and copying of this software and preparation of derivative works
  • based upon this software are permitted. Any copy of this software or
  • of any derivative work must include the above copyright notice of
  • Rodrigo Morales Alvarado, this paragraph and the one after it.
  • This software is made available AS IS, and THE AUTHOR DISCLAIMS
  • ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE
  • IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  • PURPOSE, AND NOT WITHSTANDING ANY OTHER PROVISION CONTAINED HEREIN, ANY
  • LIABILITY FOR DAMAGES RESULTING FROM THE SOFTWARE OR ITS USE IS
  • EXPRESSLY DISCLAIMED, WHETHER ARISING IN CONTRACT, TORT (INCLUDING
  • NEGLIGENCE) OR STRICT LIABILITY, EVEN IF Rodrigo Morales Alvarado IS ADVISED
  • OF THE POSSIBILITY OF SUCH DAMAGES.
  • All Rights Reserved.

RefGen plug-in is an Eclipse plug-in developed at Polytechinique de Montreal for performing automatic refactoring of software anti-patterns by Christian Kabulo and Rodrigo Morales. The Eclipse plug-in It is based on the MS dissertation titled "RefACO DEVELOPMENT OF A TOOL FOR AUTOMATIC CODE REFACTORING" by Juan María Frías Hidalgo (University of Malaga), which uses an early version of Ant Colony Optimization developed by Rodrigo Morales.

RefGen implements "RePOR", which is an automatic refactoring approach generated at Polytechnique de Montreal by Rodrigo Morales as part of its Ph.D. Thesis.

RePOR leverage Partial Order reduction to automatically detect, generate and schedule refactoring operations, reducing the search effort (measured in time and number of evaluations) required, compared to state-of the art metaheuristics like Genetic Algorithm and Ant Colony. A research paper on RePOR was submitted to Journal of Systems and Software.

The detection of anti-patterns is based on DECOR, and implemented using the set of tools provided by Ptidej tool suite.

So far, RefGen supports the refactoring of five anti-patterns, namely Blob, Lazy Class, Long-parameter list, spaghetti code, and Speculative Generality.

Why refactoring and why you should care

By continuously improving the design of code, we make it easier and easier to work with. This is in sharp contrast to what typically happens: little refactoring and a great deal of attention paid to expediently adding new features. If you get into the hygienic habit of refactoring continuously, you'll find that it is easier to extend and maintain code. — Joshua Kerievsky, Refactoring to Patterns

Manual refactoring is hard due to:

  • Many options to choose
  • Refactoring solutions can be conflicted, making difficult to decide which refactorings apply and in which order

img1

For all reasons above we developed an automated approach to refactor a system, requiring a minimal interaction from developer.

Are refactoring tools reliable?

As far as I can tell, there is not an automated tool that can totally replace developers. However, software users are relying more and more on automated tools to perform their daily activities. From finding an address using a maps app, to self-driving cars, automated approaches are pervasive, and research communities are pushing forward to simplify daily tasks.

To investigate whether automated refactoring tools affect the understandability of system during code comprehension tasks, we performed an empirical study where: (1) We surveyed 80 developers, asking them to identify from a set of 20 refactoring changes if they were generated by developers or by a tool, and to rate the refactoring changes according to their design quality; (2) we asked 30 developers to complete code comprehension tasks on 10 systems that were refactored by either a freelancer or an automated refactoring tool. To make comparison fair, for a subset of refactoring actions that introduce new code entities, only synthetic identifiers were presented to practitioners. We measured developers’ performance using the NASA task load index for their effort, the time that they spent performing the tasks, and their percentages of correct answers. Our findings, despite current technology limitations, show that it is reasonable to expect refactoring tools to match developer code. Indeed, results show that for 3 out of the 5 anti-pattern types studied, developers could not recognize the origin of the refactoring (i.e., whether it was performed by a human or an automatic tool). We also observed that developers do not prefer human refactorings over automated refactorings, except when refactoring Blob classes; and that there is no statistically significant difference between the impact on code understandability of human refactorings and automated refactorings. We conclude that automated refactorings can be as effective as manual refactorings. However, for complex anti-patterns types like the Blob, the perceived quality achieved by developers is slightly higher.

RefGen plug-in installation and tutorial

Please visit the wiki in this repository for further details. In addition, you can run RefGen in simulation mode (applying refactoring to an abstract model, without modifying your code) to test our tool.

Do not forget to fork our repository to have the latest updates

Research.

If you want to use RefGen in your research, please cite at least the following reference:

  • Morales, R.; Khomh, F.; and Antoniol, G. RePOR: Mimiking humans on refactoring tasks. Are we there yet?. Empirical Software Engineering. 2020 DOI

  • Morales, R.; Chicano, F.; Khomh, F.; and Antoniol, G. Efficient Refactoring Scheduling based on Partial order Reduction. Journal of Systems and Software. 2018 DOI

Here is the list of related research work about automatic refactoring of anti-patterns that I have done in Polytechnique de Montreal in collaboration with other well known researchers. For a complete list of works please visit my personal web site

  • Morales, R. (2015, 2-6 March 2015). Towards a Framework for Automatic Correction of Anti-Patterns. Paper presented at the 2015 IEEE 22nd International Conference on Software Analysis, Evolution, and Reengineering (SANER). DOI

  • Morales, R., Sabane, A., Musavi, P., Khomh, F., Chicano, F., & Antoniol, G. (2016, 14-18 March 2016). Finding the Best Compromise Between Design Quality and Testing Effort During Refactoring. Paper presented at the 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering (SANER). DOI

  • Morales, R., Soh, Z., Khomh, F., Antoniol, G., & Chicano, F. On the use of developers’ context for automatic refactoring of software anti-patterns. Volume 128, 2017, Pages 236-251, ISSN 0164-1212, Journal of Systems and Software. DOI

  • Morales, R., Chicano, F., Khomh, F. et al. Exact search-space size for the refactoring scheduling problem. Autom Softw Eng (2017). DOI

  • Morales, R., Saborido, R., Khomh, F., F., Chicano, F., & Antoniol, G, "EARMO: An Energy-Aware Refactoring Approach for Mobile Apps," in IEEE Transactions on Software Engineering, vol. PP, no. 99, pp. 1-1. doi

refgen's People

Contributors

cypherkhris avatar moar82 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

krunal96

refgen's Issues

refactoring CH weka

An error making the hierarchy of the type outputlogger was found when performing CH in Weka
wekach

[_nodeId=116: executed: _type=CollapseHierarchy: source class=weka.core.logging.Logger: target class=weka.core.logging.ConsoleLogger: sccId=-1],

Refactoring suggestions for inline class failed to consider inheritance

Description

When SAD detects lazy class, RefGen proposes to inline the class to the class that makes use of it. However, there are some cases where the classes do not implement any method, but extend a parent class with the functionality used in the target class to inline the supposedly "lazy class" (source class). This is a case of false positive that could be fixed directly in SAD from PtiDej, (a.k.a, DECOR). From the refactoring suggestion engine (a.k.a, SACO) it could be validated if source class extends another class do not propose the refactoring.

###Affects
Eclipse Plug-in, Simulation mode (command line), SAD (PtiDej)

###Reproducibility
at-robotsj, forked from sourceforge in my github account.
Check the following commit moar82/at-robots@522a07e the refactored was applied using RefGen, broken the build.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.