Identifying refactoring opportunities for replacing type code with subclass and state
Autor: | V. Krishna Nandivada, Jyothi Vedurada |
---|---|
Rok vydání: | 2018 |
Předmět: |
Class (computer programming)
business.industry Computer science 05 social sciences Program transformation 020207 software engineering Static program analysis 02 engineering and technology computer.software_genre Field (computer science) Identification (information) Code refactoring 0502 economics and business 0202 electrical engineering electronic engineering information engineering Software design Safety Risk Reliability and Quality Software engineering business computer 050203 business & management Software Agile software development |
Zdroj: | Proceedings of the ACM on Programming Languages. 2:1-28 |
ISSN: | 2475-1421 |
DOI: | 10.1145/3276508 |
Popis: | Refactoring is a program transformation that restructures existing code without altering its behaviour and is a key practice in popular software design movements, such as Agile. Identification of potential refactoring opportunities is an important step in the refactoring process. In large systems, manual identification of useful refactoring opportunities requires a lot of effort and time. Hence, there is a need for automatic identification of refactoring opportunities. However, this problem has not been addressed well for many non-trivial refactorings. Two such non-trivial, yet popular refactorings are “Replace Type Code with Subclass” (SC) and “Replace Type Code with State” (ST) refactorings. In this paper, we present new approaches to identify SC and ST refactoring opportunities. Our proposed approach is based around the notion of control-fields . A control-field is a field of a class that exposes the different underlying behaviors of the class. Each control-field can lead to a possible SC/ST refactoring of the associated/interacting classes. We first present a formal definition of control-fields and then present algorithms to identify and prune them; each of these pruned control-fields represents a refactoring opportunity. Further, we present a novel flow- and context-sensitive analysis to classify each of these refactoring opportunities into one of the SC and ST opportunities. We have implemented our proposed approach in a tool called Auto-SCST, and demonstrated its effectiveness by evaluating it against eight open-source Java applications. |
Databáze: | OpenAIRE |
Externí odkaz: |