ML Code Refactor Renaming Recommender
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In software development, reviewing and renaming code can be time-consuming and resource-intensive, especially when the reviewer is unfamiliar with the coding conventions used by the original author, leading to confusion and inefficiency.
Innovation Solution
A computer-implemented method and system that uses a machine learning model to analyze source code and docstrings to recommend improved function and class names, by tokenizing names, generating feature vectors, and training a regression model to predict more appropriate naming conventions, thereby facilitating code refactor renaming.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Manufacturing precision
If manual code review and renaming is performed by human reviewers, then naming conventions can be properly evaluated and enforced, but the process becomes time-consuming and resource-intensive
Solution Approach 1:
The system enables code to be automatically analyzed and renamed without requiring manual human intervention. The machine learning model processes source code and docstrings independently, generating naming recommendations automatically, thus allowing the system to serve itself rather than relying on external human reviewers for every code naming task
Solution Approach 2:
The patent replaces the mechanical human review process with an automated machine learning system. Instead of human reviewers manually examining code and applying naming conventions, the system uses trained models to analyze code structures, extract features from docstrings, and generate naming recommendations automatically, substituting human mechanical review with computational processing
2Adaptability or versatility
If reviewers are unfamiliar with the original author's coding conventions, then diverse perspectives can be brought to code review, but confusion and inefficiency increase
Solution Approach 1:
The system introduces an intermediary machine learning model that learns and internalizes the original author's coding conventions from training data. This intermediary then mediates between the reviewer and the code, translating unfamiliar conventions into understandable naming recommendations, thus bridging the gap between diverse reviewer perspectives and author-specific conventions without causing confusion
3Manufacturing precision
If more time is spent on code review and renaming, then naming accuracy and consistency improve, but development timeline and resources increase
Solution Approach 1:
The system performs preliminary action by pre-training machine learning models on extensive code datasets before actual code review. The models learn naming conventions, patterns, and best practices in advance, so that during actual code review, they can quickly generate accurate naming recommendations without requiring extensive manual analysis time, thus maintaining high consistency while reducing review time
Data Source
AI summary
An approach to code refactor renaming may be provided. Source code with a naming convention for functions and classes can be presented to a machine learning model. The model may identify the names for functions and classes. The identified names may be tokenized. Docstrings associated with functions and classes may be identified. Code for the identified functions and classes and associated may be input into a feature vector generation mechanism. A model may be trained mapping the generated feature vectors to tokenized identified names, via regression. The model can be utilized to analyze input code with the same naming convention to predict names for functions and classes, allowing for the recommendation of function and class names in accordance with the programming code naming convention.


