Code Reuse Quantification via Bill of Materials
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current software development lacks an effective automated method to accurately quantify code reuse, as identifying reused lines of code is complex due to the dynamic nature of software development languages and the introduction of new features and languages.
Innovation Solution
An automated system that generates a bill of materials for source code, queries a knowledge base for known call signatures, and estimates the number of reused lines based on detected signatures, refining estimates for unmatched signatures and storing them for future use.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If automated methods are used to identify reused code, then productivity is improved, but measurement precision deteriorates due to the dynamic nature of software languages and new features
Solution Approach 1:
The system performs preliminary actions by generating a bill of materials for the source code before analysis, and by maintaining a knowledge base of known call signatures in advance. This preparation enables the automated quantification process to efficiently match code patterns against pre-established reference data, improving productivity while maintaining precision through structured preliminary organization of analysis resources
Solution Approach 2:
The system implements feedback mechanisms by continuously refining reuse estimates based on detected call signatures and by updating the knowledge base with newly identified signatures. The feedback loop allows the system to adjust its measurement precision dynamically as it encounters new code patterns and language features, thereby maintaining accuracy while processing diverse software languages
2Measurement precision
If comprehensive code analysis is performed to accurately identify reused lines, then measurement precision is improved, but device complexity increases due to handling dynamic languages and new features
Solution Approach 1:
The system segments the code analysis process into distinct components: generating a bill of materials, querying for known call signatures, detecting signatures in source code, and calculating reuse estimates. This segmentation reduces device complexity by breaking down the complex task of identifying reused code in dynamic languages into manageable, modular steps that can be independently optimized and maintained
Solution Approach 2:
The system introduces intermediaries in the form of a knowledge base that stores known call signatures and a bill of materials that structures the source code information. These intermediaries simplify the analysis process by providing structured intermediate representations that bridge the complexity of dynamic language features and the requirements for accurate reused code identification
Data Source
AI summary
A method includes generating a bill of materials for a piece of source code, where the piece of source code comprises a plurality of lines of code, providing the bill of materials to a knowledge base with a request for known call signatures, receiving, from the knowledge base, a list comprising a plurality of known call signatures and a plurality of reuse estimates, wherein each reuse estimate of the plurality of reuse estimates indicates an estimate of a number of lines of reused code associated with one call signature of the plurality of known call signatures, generating an initial calculation of a number of lines of reused code that are present in the piece of source code, using the list comprising the plurality of known call signatures, and generating a report indicating an amount of the source code that comprises reused code, based on at least the initial calculation.


