Code Quality Analysis via Complexity and Dependency Metrics

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Software developers face challenges in identifying and addressing low-quality source code that can hinder development processes, lead to unpredictable results, and be harmful to systems due to its complexity, high dependency, and low cohesion, which existing evaluation methods fail to adequately assess.

Innovation Solution

A system analyzes source code by determining complexity, dependency, and cohesion metrics to classify code groups as high-complexity, high-dependence, or low-cohesion, and flags them as low-quality, providing a user interface to alert developers and facilitate improvement.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If developers use legacy code and develop quickly to meet market demands, then productivity is improved, but code quality deteriorates resulting in unpredictable and harmful results

Engineering Contradiction:
Improvesoftware development speedVSAvoidcode predictability
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The system performs preliminary analysis of code quality metrics (complexity, dependency, cohesion) before code is deployed or causes problems. By evaluating code groups in advance using automated metrics collection and classification, the system enables developers to identify and fix low-quality code patterns before they lead to unpredictable behavior or system harm, thus maintaining both productivity and reliability.

Inventive Principle:
Principle #10Preliminary action

2Adaptability or versatility

If developers create complex code to meet customer demands, then adaptability is improved, but code maintainability deteriorates

Engineering Contradiction:
Improvecode flexibilityVSAvoidcode maintainability
Core Design Contradiction:
Adaptability or versatilityVSEase of repair

Solution Approach 1:

The system changes the parameters used to evaluate code by introducing specific metrics for complexity, dependency, and cohesion. By measuring these parameters automatically and comparing them against threshold values, the system can identify code groups that have become too complex to maintain. This enables objective assessment and refactoring decisions based on quantitative data rather than subjective judgment, helping maintain code quality even as adaptability requirements increase.

Inventive Principle:
Principle #35Parameter changes

3Measurement precision

If existing evaluation methods are used to assess code quality, then some code attributes are measured, but low-quality code groups cannot be accurately identified

Engineering Contradiction:
Improvecode quality assessment accuracyVSAvoidevaluation system complexity
Core Design Contradiction:
Measurement precisionVSDevice complexity

Solution Approach 1:

The system segments code into discrete code groups (such as classes, methods, or modules) and evaluates each segment independently using specific metrics. By dividing the overall codebase into manageable units and assessing their complexity, dependency, and cohesion separately, the system can accurately identify low-quality code groups without being overwhelmed by the complexity of the entire codebase. This segmented approach enables precise identification while keeping the evaluation process manageable.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentEP3236351B1Identifying low-quality code
Publication Date: 2018.06.27 ACCENTURE GLOBAL SOLUTIONS LTD
  • EP3236351B1 patent drawingFigure 1
  • EP3236351B1 patent drawingFigure 2
  • EP3236351B1 patent drawingFigure 3

AI summary

Methods, systems, and apparatus, including computer programs encoded on computer storage media, for identifying low-quality groups of source code. In one aspect, a method includes receiving code groups that each include source code. For each code group, a level of complexity of methods within the source code included in the code group is determined. A code group is classified as a high-complexity code group whenever the level of complexity satisfies a threshold. For each code group, a number of attributes of other code groups on which members of the code group depend is determined. A code group is classified as a high-dependence code group whenever the number of attributes of other code groups on which members of the code group depends satisfies a threshold. A code group is classified as a low-quality code group whenever the code group is a high-complexity code group and a high-dependence code group.