Searching for Refactoring Opportunities to apply the Strategy Pattern

  • Guinther de B. Pauli UFSM
  • Eduardo K. Piveta UFSM

Resumo


It is difficult to maintain and to adapt poorly written code presenting shortcomings in its structure. Refactoring techniques are used to improve thecode and the structure of applications, making them better and easier to modify. Design patterns are reusable solutions used in similar problems in object-oriented systems, so there is no need to recreate the solutions. Applying design patterns in the context of refactoring in a corrective way becomes a desired activity in the life cycle of a specific software system. However, in large-scale projects, the manual examination of artefacts to find problems and opportunities to apply a design pattern is a hard task. In this context, wepresent a metric-based heuristic function to detect where the Strategy designpattern can be applied in a given project. To evaluate the heuristic functionand its results we have also built a tool to show the results. This tool canexamine source code using ASTs (Abstract Syntax Trees), searching for opportunities to apply the Strategy pattern, indicating the exact location in the source code where the pattern is suggested, also showing some evidences usedin the detection.
Publicado
27/05/2014
Como Citar

Selecione um Formato
PAULI, Guinther de B.; PIVETA, Eduardo K.. Searching for Refactoring Opportunities to apply the Strategy Pattern. In: SIMPÓSIO BRASILEIRO DE SISTEMAS DE INFORMAÇÃO (SBSI), 10. , 2014, Londrina. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2014 . p. 357-368. DOI: https://doi.org/10.5753/sbsi.2014.6127.