Microservice Refactoring via Code Segment Similarity Analysis
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Defining the correct granularity of microservices in a microservices architecture is a difficult and time-consuming process, requiring significant effort and resources, and existing refactoring methods lack efficiency in identifying opportunities for merging or splitting microservices based on code similarity and complexity.
Innovation Solution
A system that compares code segments across microservices to determine similarity scores, recommending merging or splitting based on thresholds, using tools like diff utilities and graph analysis to optimize microservice boundaries and reduce complexity.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If manual refactoring process is used to define microservice boundaries, then refactoring can be performed, but it requires significant time and money and is error-prone
Solution Approach 1:
The patent replaces manual mechanical refactoring processes with automated computer-based analysis. The system automatically compares code segments across microservices using computational algorithms to identify similarities and generate refactoring recommendations, eliminating the need for manual code review and analysis while improving both speed and accuracy.
Solution Approach 2:
The system enables self-service refactoring analysis by automatically comparing code segments and generating recommendations without requiring manual intervention. The computer system performs the entire analysis process autonomously, from code comparison to recommendation generation, allowing developers to obtain refactoring insights on-demand.
2Productivity
If existing refactoring methods are used, then basic micro-refactorings can be performed, but they lack efficiency in identifying opportunities for merging or splitting microservices
Solution Approach 1:
The patent segments the refactoring analysis process into distinct computational steps: code segment comparison, similarity score calculation, threshold evaluation, and recommendation generation. This segmentation allows the system to efficiently handle complex refactoring scenarios by breaking down the overall task into manageable, automated components.
Solution Approach 2:
The system introduces quantitative parameters (similarity scores, thresholds) to automate refactoring decision-making. By transforming qualitative code similarity assessment into measurable numerical comparisons, the system efficiently identifies refactoring opportunities that would be difficult to detect through manual review.
3Adaptability or versatility
If microservice boundaries are frequently adjusted through refactoring, then adaptability improves, but the process becomes tedious and iterative requiring significant resources
Solution Approach 1:
The system performs preliminary automated analysis to identify potential refactoring opportunities before developers commit to boundary changes. By pre-calculating similarity scores and generating recommendations, the system prepares refactoring pathways in advance, making boundary adjustments easier and more informed when needed.
Solution Approach 2:
The system provides feedback through automated refactoring recommendations based on code similarity analysis. This feedback loop allows developers to iteratively adjust microservice boundaries with guidance from the system, reducing the tedium of manual trial-and-error while maintaining adaptability.
Data Source
AI summary
A system recommends the refactoring of microservices. The system determines a segments similarity score based on comparing first code segments, associated with a first microservice in an application, against second code segments, associated with a second microservice in the application. The system determines whether the segments similarity score satisfies a segments similarity threshold. The system determines microservices similarity scores based on comparing a size of similar code segments in the first code segments and the second code segments against sizes of the first microservice and the second microservice, if the segments similarity score satisfies the segments similarity threshold. The system determines whether any microservices similarity score satisfies a microservices similarity threshold. The system outputs a recommendation to merge the first microservice with the second microservice, if any microservices similarity score satisfies the microservices similarity threshold.


