Code Generation Template Adaptation via Framework Extraction

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Developing and maintaining code generation templates is a time-consuming and error-prone process, especially when new requirements arise, as complex templates need to be adapted without introducing new errors and ensuring existing assets remain operational.

Innovation Solution

A method and system for automatically identifying common program code constructs in generated code files and moving them into a code framework, allowing templates to reference the framework instead of hardcoding the constructs, thereby simplifying template modification and reducing the need for changes across multiple templates.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If code generation templates are manually developed and maintained to handle new requirements, then code generation functionality can be adapted, but template modification becomes time-consuming and error-prone

Engineering Contradiction:
Improvetemplate adaptabilityVSAvoidtemplate modification time
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The system enables self-service by automatically analyzing generated code files to identify common constructs, creating framework classes, and modifying templates to reference these frameworks without human intervention. This automation eliminates manual template maintenance while preserving adaptability to new requirements.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system performs preliminary action by proactively analyzing code files and extracting common constructs before template modification is needed. Framework classes are created in advance, and templates are automatically updated to reference these pre-prepared frameworks, streamlining the adaptation process.

Inventive Principle:
Principle #10Preliminary action

2Adaptability or versatility

If complex templates are adapted to meet new requirements, then functionality is improved, but errors may be introduced and existing assets may become non-operational

Engineering Contradiction:
Improvetemplate functionalityVSAvoidtemplate reliability
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The system extracts common code constructs from generated files and places them into separate framework classes. This separation isolates the stable, proven code into reusable components that can be referenced by templates without risking corruption of existing functionality during template adaptation.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The system creates framework classes that serve as reusable templates for common constructs. Instead of modifying existing complex templates directly, the system copies proven code patterns into framework classes that can be safely referenced, reducing the risk of introducing errors while maintaining functionality.

Inventive Principle:
Principle #26Copying

3Ease of manufacture

If common code constructs are hardcoded in multiple templates, then each template is self-contained, but template complexity increases and maintenance becomes difficult

Engineering Contradiction:
Improvetemplate maintenance easeVSAvoidtemplate complexity
Core Design Contradiction:
Ease of manufactureVSDevice complexity

Solution Approach 1:

The system creates universal framework classes that can be referenced by multiple templates. These framework classes encapsulate common code constructs that serve multiple purposes across different templates, reducing overall system complexity while improving maintainability through centralized management.

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

Solution Approach 2:

The system segments code by separating common constructs into distinct framework classes from the templates that use them. This segmentation reduces template complexity by removing redundant code and creates a hierarchical structure where templates reference specialized framework components, making maintenance easier.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS8448132B2Systems and methods for modifying code generation templates
Publication Date: 2013.05.21 SAP SE
  • US8448132B2 patent drawing
  • US8448132B2 patent drawing
  • US8448132B2 patent drawing

AI summary

Embodiments of the present invention include systems and methods for template reverse engineering. In one embodiment, the present invention includes a computer-implemented method for code generation comprising receiving a template for generating code, receiving a model for generating code, processing the template and the model in a code generator, and in accordance therewith, generating code based on the model and the template, and automatically identifying a common program code construct in two or more of the generated code files. The common code may be automatically extracted from the generated code and embedded in a framework, and the templates may be modified to reference the framework.