Machine Learning Source Code Boundary Prediction

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Source code refactoring and rearchitecting are cumbersome and expensive processes, often requiring large teams and taking months or years to address technical debt and migrate to cloud-based infrastructure, especially when dealing with large legacy code bases.

Innovation Solution

Implementing machine learning models to automate the prediction and introduction of source code boundaries, such as functions, APIs, and other logical barriers, by training models on ground truth boundaries and using techniques like inlining and synthetic boundary creation to generate candidate boundaries for refactoring and rearchitecting.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If machine learning models are used to automate source code boundary prediction, then productivity and time efficiency are improved, but device complexity and implementation cost increase

Engineering Contradiction:
Improverefactoring speedVSAvoidsystem complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The patent introduces machine learning models as an intermediary between human developers and source code refactoring tasks. The ML model processes boundary-less source code files and predicts candidate boundaries, acting as a mediator that automates the complex decision-making process of where to introduce boundaries, thereby improving productivity while managing system complexity through specialized automated components.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Manufacturing precision

If traditional manual refactoring methods are used, then manufacturing precision and code quality are maintained, but loss of time and productivity are reduced

Engineering Contradiction:
Improveboundary accuracyVSAvoidrefactoring duration
Core Design Contradiction:
Manufacturing precisionVSLoss of time

Solution Approach 1:

The patent implements a feedback mechanism where the machine learning model is trained using ground truth boundaries from boundaried source code files. The model's predictions are compared against actual boundaries, and the training process refines the model's accuracy over time. This feedback loop enables the system to maintain high boundary prediction accuracy while dramatically reducing refactoring time compared to manual methods.

Inventive Principle:
Principle #23Feedback

3Adaptability or versatility

If ground truth boundaries are removed to create boundary-less source code files for training, then adaptability and model learning capability are improved, but manufacturing precision of original code structure is temporarily reduced

Engineering Contradiction:
Improvemodel learning capabilityVSAvoidcode structure integrity
Core Design Contradiction:
Adaptability or versatilityVSManufacturing precision

Solution Approach 1:

The patent applies preliminary action by removing ground truth boundaries from source code files before the machine learning training process. This creates boundary-less source code files that serve as training data, allowing the model to learn boundary prediction patterns without being biased by pre-existing boundary structures. The original code structure integrity is preserved and can be restored through the model's predictions after training completes.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS11893384B2Refactoring and/or rearchitecting source code using machine learning
Publication Date: 2024.02.06 GOOGLE LLC
  • US11893384B2 patent drawing
  • US11893384B2 patent drawing
  • US11893384B2 patent drawing

AI summary

Implementations are described herein for leveraging machine learning to automate source code refactoring and/or rearchitecting. In various implementations, one or more ground truth boundaries may be removed from one or more boundaried source code files to produce one or more boundary-less source code files. One or more of the boundary-less source code files may be processed using a machine learning model to predict one or more candidate boundaries for reintroduction into the one or more boundary-less source code files. The one or more ground truth boundaries may be compared with the one or more predicted candidate boundaries. The machine learning model may be trained based on the comparing.