Artículo: Naming Methods with Large Language Models after Refactoring Operations
Archivos
Fecha
Editor
Publicado en
Licencia Creative Commons
Resumen
In Object-oriented Programming, the Cognitive Complexity (CC) of software is a metric of the difficulty associated with understanding and maintaining the source code. This is usually measured at the method level, taking into account the number of control flow sentences and their nesting level. One way to reduce the CC associated to a method is by extracting code into new methods without altering any existing functionality. However, this involves deciding representative names for the new methods containing the extracted code. This work studies the capability of large language models for assigning names to new extracted methods during the evolution of a code base. Such evolution comprises continuous code extraction operations to study how the semantic of the new methods name evolves. We use the OpenAI Chat API with the textdavinci003 model in order to perform coding tasks. We found the precision of the model to be highly acceptable, achieving in many cases a level similar to that of a human which paves the way for new tooling. However, there are also a few cases in which it fails to provide appropriate names or does not even provide a name inside the indicated standards.


