An Automated Refactoring Approach to Remove Unnecessary Complexity in Source Code

  • Nathan Manera Magalhães IF Sudeste MG
  • Heleno de Souza Campos Junior UFJF
  • Marco Antônio Pereira Araújo IF Sudeste MG / UFJF
  • Vânia de Oliveira Neves UFJF

Resumo


Programming apprentices may choose to prioritize the correct functioning of a source code without focusing on their quality, making them difficult to maintain and test. Based on that, a phenomenon called unnecessary structural complexity may occur, in which a program has a cyclomatic complexity value that can be reduced without affecting its external behavior. In a previous work, we developed an approach and tool to address this problem. The approach is able to identify the presence of unnecessary cyclomatic complexity and to show the developer a suggestion to restructure the source code, through a control flow graph. The goal of this paper is to automate the source code refactoring process to support the elimination of unnecessary cyclomatic complexity. We performed two experimental studies to evaluate the approach in the academic context. The evidences provided by these studies suggest that the approach is able to support unnecessary cyclomatic complexity removal. We could not find, however, evidences about the implications of such approach on unit tests development.
Palavras-chave: Source Code Refactoring, Software Testing, Software Quality, Cyclomatic Complexity, Control Flow Graph
Publicado
18/09/2017
MAGALHÃES, Nathan Manera; CAMPOS JUNIOR, Heleno de Souza; ARAÚJO, Marco Antônio Pereira; NEVES, Vânia de Oliveira. An Automated Refactoring Approach to Remove Unnecessary Complexity in Source Code. In: SIMPÓSIO BRASILEIRO DE TESTES DE SOFTWARE SISTEMÁTICO E AUTOMATIZADO (SAST), 2. , 2017, Fortaleza/CE. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2017 . p. 21-30.