# Design Pattern Detection Using Similarity Scoring Algorithm

Published: 2021-09-13 05:20:09  Category: Learning, Architecture

Type of paper: Essay

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Hey! We can write a custom essay for you.

All possible types of assignments. Written by academics

GET MY ESSAY Similarity scoring algorithm is used for calculating the similarity between vertices of design pattern graph and vertices of system or subsystem graph. The similarity for two vertices can be defined in the form of a similarity matrix S of nB × nA where sij entry states how similar vertex j in GA is to vertex i in GB. The process leads to different similarity matrices of size nB×nA where each matrix define its own kind of information. To identify overall similarity between design pattern and system, information provided by all matrices is exploited. Result of the similarity is valid if similarity score is bounded within the range of 0 and 1. To get valid similarity we use normalization which is done by dividing the elements of resulting matrix by total no of matrices.
Design Pattern Detection by Template Matching
To detect a design pattern from a software system, a template matching method is used, where we identify exact matches of pattern instances from source code and also its possible variants. The problem of design pattern detection is reduced into a problem of matrix matching. Hence this method encodes both pattern and system knowledge into overall matrixes to calculate similarity score by normalized cross correlation. Normalized cross correlation (CCn) calculate the degree of similarity between a design pattern and the part of a system given by the formulaCCn = ∑f(x) • g(x) / |f(x)| •|g(x)|
It defines the cosθ value, where θ is the angle between vector f and g. The maximum value is 1 when f and g is an exact match, i.e., θ= 0. While detecting a pattern we actually search for unique set of design features of the pattern from sour e code. We create an n × n matrix for the generalization relationship, where n is the number of classes. If the ith and jth classes have the generalization relationship, the corresponding cell of the matrix is set to 1. Otherwise, it is set to 0. This approach also avoid the false positives caused by individual matches. However, there will be minor effect on this approach by adding new feature matrixes. The approach encodes eight design features but these design features are not complete.
Detection of Design Pattern Using Graph Isomorphism and Normalized Cross Correlation
Paper presents an approach for design pattern detection with the help of Graph Isomorphism and Normalized Cross Correlation techniques. In this approach, both the system UML class diagram and design pattern class diagrams are converted into directed graphs. The nodes of the graph act as classes whereas the edges connecting the nodes refers to the relationship among the corresponding classes. If any two classes are connected, having more than one relationship, then the relationship weight becomes the multiplication of the individual weights corresponding to the relationship. First of all we generate XML files from source code using eclipse from where we collect information of system graph and pattern graph which help to identify Contribution Value of Class in both SG and PG. Then we extract system subgraph and pattern graph on which further normalized cross correlation is performed which helps to examine percentage matching occurrences. The Graph Isomorphism technique is useful to detect design patterns in order to enhance usability and reliability of the proposed technique.
Design Pattern Detection Using Similarity Scoring
Design pattern detection with similarity score technique employ a similarity algorithm graph, whose input is both the system graph and the pattern graph, then calculates similarity scores between their vertices. The major benefit of this methodology is detection of modified version of design pattern. The system is partitioned to clusters of hierarchies to overcome efficiency problem due to exploration space, so that the algorithm can be applied to subsystems rather than to the whole system. In methodology all kinds of generalization relationships are identified for building the hierarchies of inheritance. Then we construct subsystem matrices as subsystem consist on classes belonging to one or more hierarchies. Normalized similarity scores by similarity algorithm between each pattern role and each subsystem class are calculated. To seek extraction of pattern, as instance of each pattern is present in each subsystem which means that each pattern role is associated with one class. The selection of the highest score for each role is based on the observation that a class assigned a score that is less than the score of another class definitely satisfies fewer criteria according to the sought pattern description. As a result, the class with the lower score is a worse candidate for the specific pattern role. To solve the efficiency problem, irrelevant subsystems should exclude and the roles with the most unique characteristics should be preferred. In shortcomings of the system few of the targeted patterns were missed i.e. false negatives, with no false positives in the application of this methodology.

#### Warning! This essay is not original. Get 100% unique essay within 45 seconds!

GET UNIQUE ESSAY

We can write your paper just for 11.99\$

i want to copy...

This essay has been submitted by a student and contain not unique content