Statement-Level Code Extraction for Legacy Service Refactoring

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current techniques for extracting source code for services in legacy applications are complex, often return incorrect code, and lack the ability to isolate code at a statement level, leading to increased time and effort.

Innovation Solution

A computer-implemented method using processor units to identify key statements in source code, determine importance scores, and generate outputs for user-guided selection and extraction of code blocks, enhancing accuracy and modularity.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Measurement precision

If traditional slicing techniques are used to extract service code from legacy applications, then code extraction can be performed, but the process becomes increasingly complex and returns incorrect code when services extend through multiple programs

Engineering Contradiction:
Improvecode extraction accuracyVSAvoidextraction process complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The patent segments the code extraction process into distinct phases: identifying entry points, tracing execution flow, isolating key statements, and extracting code blocks. This segmentation allows the system to handle complex multi-program services by breaking them down into manageable extraction steps, improving both accuracy and process clarity

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary actions by first identifying entry points and tracing execution flow before actually extracting code. This preliminary analysis phase prepares the system by mapping out the service boundaries and dependencies, enabling more accurate extraction when services span multiple programs rather than attempting extraction without prior analysis

Inventive Principle:
Principle #10Preliminary action

2Measurement precision

If manual code extraction is performed to ensure accuracy, then correct service code can be obtained, but time and effort requirements increase significantly

Engineering Contradiction:
Improvecode extraction accuracyVSAvoidextraction time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The patent implements self-service by enabling the system to automatically identify entry points, trace execution flow, and extract code blocks without requiring manual intervention. The automated execution flow tracing and key statement identification processes allow the system to perform what would traditionally require manual analysis, significantly reducing time while maintaining accuracy through systematic automated analysis

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent incorporates feedback mechanisms where the system traces actual execution flow and uses this information to refine code extraction. By monitoring which statements are actually executed and contributing to service behavior, the system can automatically adjust extraction boundaries, ensuring accuracy without manual review while reducing extraction time through iterative automated refinement

Inventive Principle:
Principle #23Feedback

3Measurement precision

If code is extracted at a granular statement level to improve precision, then accurate service boundaries can be identified, but the complexity of identifying and managing key statements increases

Engineering Contradiction:
Improvestatement level precisionVSAvoidkey statement identification difficulty
Core Design Contradiction:
Measurement precisionVSDifficulty of detecting and measuring

Solution Approach 1:

The patent introduces an intermediary layer between raw code and extracted service: the execution flow trace and key statement identification mechanism. This intermediary automatically analyzes which statements are executed and contribute to service behavior, translating granular statement-level analysis into manageable code blocks without requiring direct manual identification of each key statement, thus reducing difficulty while maintaining precision

Inventive Principle:
Principle #24Intermediary (Mediator)

Solution Approach 2:

The patent replaces manual mechanical identification of key statements with automated computational analysis. By using execution flow tracing and automated key statement detection algorithms, the system substitutes human analysis with machine-based detection, reducing the difficulty of identifying and managing key statements at granular precision levels through systematic automated processes rather than manual inspection

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

4Adaptability or versatility

If services are extracted as modular standalone components, then maintenance and scalability improve, but the extraction process becomes more complex when services span multiple programs

Engineering Contradiction:
Improveservice modularityVSAvoidextraction process complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent applies the extraction principle by systematically removing service code from its original multi-program context and isolating it as a standalone modular component. By tracing execution flow and identifying boundaries, the system extracts only the necessary code blocks required for service functionality, creating independent modular services that can be maintained and scaled separately while reducing the complexity of managing distributed service code across multiple programs

Inventive Principle:
Principle #2Taking out (Extraction)

Data Source

PatentUS12561134B2Function code extraction
Publication Date: 2026.02.24 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US12561134B2 patent drawing
  • US12561134B2 patent drawing
  • US12561134B2 patent drawing

AI summary

A computer implemented method extracts code for a service. Key statements are identified for the service in a source code for a region of interest in an application in response to a program selection selecting a program in the region of interest. Importance scores are determined for the key statements based on an amount of the source code executed by each of the key statements in the source code in the region of interest. An output is generated that comprises the key statements associated with the importance scores and portions of the source code executed in response to execution of the key statements. A number of code blocks derived from a number of the portions of the source code run for a key statement is added to a workbook in response to receiving a key statement selection of the key statement in the output.