Refactored Method Consistency Check via Automated Result Comparison

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Code refactoring in software systems can inadvertently alter the external behavior of software, leading to incorrect results in routines or subroutines, and existing testing methods may miss some test cases, making it difficult to ensure consistency between refactored and original code.

Innovation Solution

A method for performing a consistency check test that compares the results of a refactored method with its corresponding original method by assigning the results to objects and logging differences, using a consistency check feature flag to execute the test, and comparing objects based on their classes, types, and values to identify and log any discrepancies.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of manufacture

If code refactoring is performed to improve readability and performance, then code maintainability and execution efficiency are improved, but the external behavior of the software system may be inadvertently altered causing incorrect results

Engineering Contradiction:
Improvecode maintainabilityVSAvoidexternal behavior consistency
Core Design Contradiction:
Ease of manufactureVSReliability

Solution Approach 1:

The system performs preliminary actions by executing both the original method and the refactored method before comparing their results. This allows the refactored code to be tested and validated against the original behavior before full deployment, ensuring that readability and performance improvements do not compromise external behavior consistency.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The system implements feedback by comparing the results of the refactored method with the original method and logging any differences. This feedback mechanism allows developers to identify and correct unintended behavioral changes, ensuring that refactoring improves code quality without altering the external behavior of the software system.

Inventive Principle:
Principle #23Feedback

2Reliability

If comprehensive test cases are run on refactored code base, then consistency of refactored code can be verified, but some test cases may inevitably be missed

Engineering Contradiction:
Improveconsistency verificationVSAvoidtest case coverage
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The system creates a copy of the original method's execution path by running the refactored method with the same inputs and comparing the outputs. This copying approach ensures that all test cases that were previously covering the original method are automatically applied to the refactored method, eliminating the need to manually design additional test cases while maintaining comprehensive coverage.

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The consistency checking system serves multiple functions: it verifies consistency, identifies differences, logs results, and provides feedback for further testing. This multi-functional approach maximizes the value of each test case executed, improving reliability without proportionally increasing the number of test cases needed.

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

3Measurement precision

If manual testing is performed to verify refactored code behavior, then test coverage can be maintained, but the process is time-consuming and error-prone

Engineering Contradiction:
Improvebehavior verification accuracyVSAvoidtesting time
Core Design Contradiction:
Measurement precisionVSLoss of time

Solution Approach 1:

The system performs self-service by automatically executing both the original and refactored methods, comparing their results, and generating consistency reports without requiring manual intervention. This automated approach maintains high measurement precision in behavior verification while dramatically reducing the time required compared to manual testing processes.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The system replaces the mechanical manual testing process with an automated computational system that programmatically executes methods, compares outputs, and generates reports. This substitution eliminates human error and time constraints associated with manual testing while maintaining or improving verification accuracy through systematic automated comparison.

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

Data Source

PatentUS11061813B2Systems and methods for checking consistency of refactored methods
Publication Date: 2021.07.13 ATLASSIAN PTY LTD
  • US11061813B2 patent drawing
  • US11061813B2 patent drawing
  • US11061813B2 patent drawing

AI summary

Systems and methods for performing a consistency check test on a refactored method are disclosed. The method includes: at a computer, at execution time, receiving a refactored result generated by executing a refactored method and an old result generated by executing a corresponding original method associated with the refactored method; defining the refactored result generated by executing the refactored method as a first object and defining the old result generated by executing the original method as a second object; comparing the first object with the second object to identify any differences between the refactored result and the old result; and upon identifying one or more differences between the first object and the second object logging the differences in a log file.