Code Generator with Metadata Infrastructure for Inter-Type Declarations
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing code generators for computer systems are inefficient and costly for maintenance and modification, as they require ongoing dependency and are complex to install and maintain, especially when supporting round-tripping and inter-type declarations.
Innovation Solution
A code generator that emits inter-type declarations and uses a metadata infrastructure to determine and modify their content, automatically generating source code files by monitoring file changes and sending notifications, allowing for independent maintenance and modification without ongoing dependency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If template-based code generators are used to automatically generate source code files, then productivity during initial program creation is improved, but maintenance and modification become more complex and costly due to ongoing dependency requirements
Solution Approach 1:
The code generator is divided into independent add-on units that can be selectively applied to different source code files. Each add-on unit processes specific aspects of code generation independently, allowing maintenance personnel to target and modify only the necessary components without affecting the entire code generation system, thus reducing overall maintenance complexity.
Solution Approach 2:
The code generator system maintains an internal metadata model that automatically tracks changes to generated source code files. When modifications are made, the system automatically updates its metadata model without requiring manual intervention or reconfiguration, enabling self-maintenance and reducing the burden on maintenance personnel.
2Extent of automation
If build-time code generators are used to automatically generate additional code at compile time, then some automation is achieved, but the system remains dependent on the code generator for future maintenance and the generated files cannot be easily stored with version control systems
Solution Approach 1:
The code generator performs preliminary actions by creating source code files with embedded metadata information during the generation process. This metadata is embedded directly into the source code files themselves, allowing them to be stored and managed alongside other source code files using standard version control systems, eliminating the need for separate metadata storage mechanisms.
Solution Approach 2:
The metadata model acts as an intermediary between the code generator and the generated source code files. It maintains a mapping relationship that allows the system to track which metadata items correspond to which source code files, enabling proper version control and storage while preserving the automation benefits.
3Extent of automation
If code generators produce lengthy source code files that require manual modification and maintenance, then initial code generation is automated, but the proportion of engineering expense related to maintenance increases significantly
Solution Approach 1:
The code generator produces source code files with locally optimized metadata information embedded at specific locations within each file. This allows maintenance personnel to quickly locate and modify only the relevant sections using the embedded metadata as guides, significantly reducing the time required for maintenance compared to searching through lengthy unstructured code files.
Solution Approach 2:
The system implements feedback mechanisms where the metadata model automatically updates when source code files are modified. This feedback loop allows the code generator to learn from actual usage patterns and automatically adjust future code generation, reducing the need for manual maintenance and modification over time.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
An apparatus for automatically generating source code files in a file storage unit is disclosed. The apparatus includes a file storage unit that stores the source code files, a code generator unit that generates at least some of the source code files, wherein the code generator unit comprises, and a file unit that monitors the file storage unit to detect changes in the file storage unit and in response send file event notifications. A metadata unit that builds a metadata model relating to the source code files in the file storage unit is also provided. The metadata model comprises a plurality of metadata items, each metadata item comprises a metadata section containing metadata, a key that identifies the metadata item, and one or more dependencies of the metadata items in relation to other of the metadata items. The metadata unit sends metadata notifications according to changes to the dependencies of the metadata items. The apparatus further includes at least one add-on unit comprising a metadata provider module that provides the metadata items to the metadata unit and registers the dependencies of the metadata items on other of the metadata items.