Automated Code Rule Generation from Repetitive Edits

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Developers face the tedious and error-prone task of manually performing repetitive code edits, which are time-consuming and often result in incorrect applications due to the vastness of codebases, leading to multiple commits for a single edit task.

Innovation Solution

Automated generation of rules that synthesize transformations from observed repetitive code edits, allowing for detection and application of similar modifications across the codebase, with human validation and social review to enhance credibility and applicability.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If developers manually perform repetitive code edits across a large codebase, then they can implement necessary modifications, but the process becomes time-consuming and error-prone

Engineering Contradiction:
Improveaccuracy of code editsVSAvoidtime required for code edits
Core Design Contradiction:
ReliabilityVSLoss of time

Solution Approach 1:

The system captures the edit operation performed by the developer and automatically copies it to other locations in the codebase that have similar code structures. This eliminates manual repetition while maintaining accuracy through automated transformation rules that preserve the intent of the original edit.

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The system enables self-service automation where the developer's first manual edit automatically generates a transformation rule that the system then applies autonomously to other code locations. The system serves itself by learning from the developer's action and independently performing similar edits without further human intervention.

Inventive Principle:
Principle #25Self-service

2Reliability

If developers submit multiple commits to accomplish a single repetitive code edit task, then they can ensure correct application, but the development process becomes more complex and time-consuming

Engineering Contradiction:
Improvecorrect application of editsVSAvoidcomplexity of development process
Core Design Contradiction:
ReliabilityVSDevice complexity

Solution Approach 1:

The system provides feedback by showing the developer the locations where transformations will be applied and allowing review before execution. This feedback mechanism ensures correct application of edits while maintaining a simple, single-commit process rather than requiring multiple iterative commits.

Inventive Principle:
Principle #23Feedback

Solution Approach 2:

The system performs preliminary analysis to identify all code locations that match the transformation pattern before applying edits. This preliminary action ensures correctness by pre-validating target locations and presenting them to the developer for approval, eliminating the need for multiple corrective commits.

Inventive Principle:
Principle #10Preliminary action

3Productivity

If IDEs implement transformations for fixed classes of repetitive edits, then common edit tasks are automated, but the system cannot handle custom or novel edit patterns

Engineering Contradiction:
Improveautomation of code editsVSAvoidhandling of custom edit patterns
Core Design Contradiction:
ProductivityVSAdaptability or versatility

Solution Approach 1:

The system transitions from static, pre-defined transformation rules to dynamic rule generation. When a developer performs a manual edit, the system dynamically creates a transformation rule specific to that edit pattern, enabling automation of custom and novel edit patterns while maintaining high productivity.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The system enables self-service learning by observing developer behavior and automatically generating transformation rules tailored to the specific codebase and editing patterns. This allows the system to adapt to custom edit patterns without requiring pre-programming, enhancing both productivity and versatility.

Inventive Principle:
Principle #25Self-service

4Adaptability or versatility

If a dynamic pool of rules is made available through social review, then code modification rules become more widely applicable, but the system complexity increases

Engineering Contradiction:
Improveapplicability of code rulesVSAvoidcomplexity of rule management system
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The system creates universal transformation rules through social review that can be applied across multiple codebases and contexts. A single rule, validated by the developer community, serves multiple purposes and can be reused extensively, increasing versatility without proportionally increasing system complexity.

Inventive Principle:
Principle #6Universality (Multi-functionality)

Solution Approach 2:

The system merges individual transformation rules into a shared pool through social review, combining the wisdom of multiple developers. This consolidation reduces redundancy and manages complexity by organizing rules into a unified, reusable framework that benefits the entire developer community.

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentUS10996930B1Rules generation using learned repetitive code edits
Publication Date: 2021.05.04 MICROSOFT TECHNOLOGY LICENSING LLC
  • US10996930B1 patent drawing
  • US10996930B1 patent drawing
  • US10996930B1 patent drawing

AI summary

Assisting automation of repeated edits of code by automated generation of rules that, when applied, perform code transformations. The transformations are synthesized while observing developers make repeated code edits, and automatically perform similar modifications as those observed. This synthesized transformation defines an initial state of code to which the transformation can be applied, and defines a modification from that initial state. A rule is then generated that includes a detector mechanism that, when selected, is configured to find locations in code that have the defined corresponding initial state of the corresponding transformation. Thus, the transformation may be applied to any code to which the rule is exposed.