Idiomatic Source Code Generation via Contextual Modifiers

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing automated software generation tools produce unidiomatic source code that is inefficient, difficult to understand, and integrates poorly with human-authored codebases, leading to increased development time and resource inefficiency.

Innovation Solution

A computer-implemented method and system for transforming unidiomatic source code into idiomatic code by analyzing code sections, identifying context information, and applying idiomatic modifiers to improve formatting, naming conventions, and redundancy, thereby generating code that resembles human-authored code while maintaining functionality.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If automated source code generation tools are used, then development time and cost are reduced, but the generated code becomes unidiomatic and difficult to understand

Engineering Contradiction:
Improvedevelopment timeVSAvoidcode readability
Core Design Contradiction:
ProductivityVSEase of operation

Solution Approach 1:

The patent introduces an intermediary processing system that sits between the automated code generation tool and the final codebase. This intermediary analyzes the generated unidiomatic code and applies transformations to convert it into idiomatic code, thereby maintaining both the productivity benefits of automation and the readability benefits of human-authored code

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent replaces manual code review and refactoring processes with an automated analysis and transformation system. The system uses static analysis, pattern matching, and rule-based transformations to automatically convert unidiomatic code into idiomatic code, eliminating the need for manual intervention while preserving code quality

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

2Reliability

If unidiomatic automatically generated tests are incorporated into an existing codebase, then test coverage is increased, but it becomes difficult to ascertain test purpose and completeness

Engineering Contradiction:
Improvetest coverageVSAvoidtest purpose information
Core Design Contradiction:
ReliabilityVSLoss of information

Solution Approach 1:

The patent introduces an intermediary processing system that sits between the automated code generation tool and the final codebase. This intermediary analyzes the generated unidiomatic code and applies transformations to convert it into idiomatic code, thereby maintaining both the productivity benefits of automation and the readability benefits of human-authored code

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent replaces manual code review and refactoring processes with an automated analysis and transformation system. The system uses static analysis, pattern matching, and rule-based transformations to automatically convert unidiomatic code into idiomatic code, eliminating the need for manual intervention while preserving code quality

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

3Productivity

If automated code generation is used, then code production speed increases, but the code requires more processing and memory resources for refinement

Engineering Contradiction:
Improvecode production speedVSAvoidprocessing resources
Core Design Contradiction:
ProductivityVSUse of energy by moving object

Solution Approach 1:

The patent applies preliminary action by performing code analysis and transformation immediately after code generation, while the code structure is still fresh and easily modifiable. The system conducts static analysis, identifies unidiomatic patterns, and applies transformations in a systematic sequence, preventing the accumulation of technical debt and reducing the overall refinement burden

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent replaces manual code review and refactoring processes with an automated analysis and transformation system. The system uses static analysis, pattern matching, and rule-based transformations to automatically convert unidiomatic code into idiomatic code, eliminating the need for manual intervention while preserving code quality

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

Data Source

PatentUS11650802B2Idiomatic source code generation
Publication Date: 2023.05.16 DIFFBLUE LTD
  • US11650802B2 patent drawing
  • US11650802B2 patent drawing
  • US11650802B2 patent drawing

AI summary

A computer-implemented method comprising obtaining a first part or representation of a code section as a code part, said code part comprising a first code characteristic, analyzing the code part to identify context information related to the code section, obtaining a first idiomatic modifier based on the first code characteristic and the context information, wherein the first idiomatic modifier in use transforms a first code statement of the code part such that the transformed first code statement corresponds to an idiomatic representation of the first code statement, and generating a modified code part by applying the first idiomatic modifier to the code part.