Software key class identification method, equipment and medium

By building a class coupled network and calculating gravitational entropy index, the problem of incomplete software network construction and inaccurate key class identification in the existing technology is solved, and more accurate software key class identification and structural feature characterization are achieved.

CN119987737APending Publication Date: 2025-05-13ZHEJIANG GONGSHANG UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510090661.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

The existing software network structure is not comprehensive enough to accurately reflect the true structure of the software system, and the existing indicators to evaluate the importance of software elements are not accurate enough to accurately identify software key categories.

Method used

By analyzing various software elements and their coupling types in the software source code, a class coupling network is built, and gravitational entropy index is calculated to identify software key categories.

Benefits of technology

It realizes the construction of a more complete class coupling network, which can fully reflect the interactive relationship and structural characteristics between classes, and improves the accuracy of key class recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987737A_ABST
    Figure CN119987737A_ABST
Patent Text Reader

Abstract

The invention discloses a software key class identification method and device and a medium, and relates to the field of software developing.The method comprises the steps that various software elements in software source codes and coupling types among the elements are analyzed; the software comprises element classes, interfaces, attributes, methods and local variables; the coupling type comprises an inheritance relationship between classes, an implementation relationship between the classes and interfaces, a parameter relationship, a global variable relationship, a local variable relationship, a return type relationship, an instantiation relationship, an attribute access relationship and a calling relationship between methods; constructing a class coupling network according to various software elements and coupling types among the elements; constructing a gravitational entropy index according to the class coupling network, and calculating gravitational entropy index values of all class nodes in the class coupling network; sorting all class nodes according to the gravitational entropy index values to generate a class node sequence; and based on the class node sequence, identifying the software key class, and according to the application, the software network can be comprehensively constructed and the software key class can be accurately identified.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of software development, and in particular to a method, device and medium for identifying key software categories. Background Art

[0002] In modern society, software has become an indispensable part, and its functional and performance requirements continue to grow. However, the resulting software complexity problem has become increasingly prominent, among which the high maintenance cost accounts for more than 60% of the total software cost, and has become the main obstacle to the development of the software industry. Faced with complex legacy systems, software complexity directly affects the efficiency of maintenance and cost control, so how to understand and maintain them efficiently is the current core problem. Therefore, researching and exploring technical means that can improve the understandability and maintainability of software not only has important theoretical significance, but also has significant practical value.

[0003] The existing work still has the following deficiencies:

[0004] (1) The existing software network structure is not comprehensive enough.

[0005] Due to the limitation of the extraction accuracy of software component units, the currently constructed software networks often cannot accurately reflect the real structure of the software system. This limitation leads to defects in the details of the network description, making it difficult to fully reveal the interrelationships and dependencies between the various parts of the system. In particular, many implicit interactions are ignored, making the network unable to provide reliable support for the analysis and optimization of complex systems.

[0006] (2) Existing indicators for evaluating the importance of software elements are not accurate enough.

[0007] Existing indicators for evaluating the importance of software elements do not consider the impact of indirect (non-contact) coupling between classes and the degree distribution of neighboring nodes on class importance. They cannot accurately identify key software classes to comprehensively characterize the structural characteristics of the software. Summary of the invention

[0008] The purpose of this application is to provide a method, device and medium for identifying software key classes to solve the problem that a software network cannot be fully constructed and that software key classes cannot be accurately identified.

[0009] To achieve the above objectives, this application provides the following solutions:

[0010] In a first aspect, the present application provides a method for identifying a software key class, comprising:

[0011] Analyze various software elements in the software source code and the coupling types between the elements; the software element classes, interfaces, attributes, methods and local variables; the coupling types include inheritance relationships between classes, implementation relationships between classes and interfaces, parameter relationships, global variable relationships, local variable relationships, return type relationships, instantiation relationships, attribute access relationships and calling relationships between methods;

[0012] Construct a class coupling network based on various software elements and the coupling types between elements;

[0013] Constructing a gravitational entropy index according to the class coupling network, and calculating the gravitational entropy index values ​​of all class nodes in the class coupling network;

[0014] Sort all class nodes according to the gravitational entropy index value to generate a class node sequence;

[0015] Based on the class node sequence, key software classes are identified.

[0016] In a second aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement any of the software critical class identification methods described above.

[0017] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described methods for identifying critical software classes.

[0018] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0019] This application will build a more complete class coupling network (CCN) by fully considering various dependencies between classes, including the coupling type and direction between elements and analyzing the strength of dependencies, so that the class coupling network can comprehensively reflect the interaction relationship and structural characteristics between classes.

[0020] Starting from the relative importance of edge weights and the non-contact interaction between two class nodes, this application constructs a structural entropy index, which is a new metric for measuring class importance - the gravitational entropy index. It considers the influence of indirect (non-contact) coupling between classes and the degree distribution of neighbor nodes on class importance, and sorts all class nodes according to the gravitational entropy index value to generate a class node sequence. Classes within a set range that are ranked high or low are regarded as key classes, thereby improving the accuracy of key class identification and comprehensively characterizing the importance of the method. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 A flowchart of a method for identifying key software classes provided in an embodiment of the present application;

[0023] Figure 2 A schematic diagram of a CCN constructed according to an embodiment of the present application. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0025] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0026] The present application embodiment provides a method for identifying a software key class, which is executed by a computer device, and can be executed by a computer device such as a terminal or a server alone, or can be executed by a terminal and a server together. In the present application embodiment, Figure 1 As shown, the method includes the following steps.

[0027] S1: Analyze various software elements in the software source code and the coupling types between the elements; the software element classes, interfaces, properties, methods and local variables; the coupling types include inheritance relationships between classes, implementation relationships of classes to interfaces, parameter relationships, global variable relationships, local variable relationships, return type relationships, instantiation relationships, property access relationships and calling relationships between methods.

[0028] S2: Construct a class coupling network based on various software elements and the coupling types between elements.

[0029] S3: constructing a gravitational entropy index according to the class coupling network, and calculating the gravitational entropy index values ​​of all class nodes in the class coupling network.

[0030] S4: Sort all class nodes according to the gravitational entropy index value to generate a class node sequence.

[0031] S5: Based on the class node sequence, identify key software classes.

[0032] In an exemplary embodiment, the present application abstracts the following 9 types of coupling between categories as directed edges in CCN:<A,B> :

[0033] 1) Inheritance relation (INH): Class A inherits class B through the keyword "extends".

[0034] 2) Implements relation (IMP): Class A implements interface B through the keyword "implements".

[0035] 3) Parameter relation (PARameterrelation, PAR): There is at least one method in class A, and this method has one or more parameters with class B as data type.

[0036] 4) Global variable relation (GVR): Class A has at least one attribute whose data type is class B.

[0037] 5) Local variable relation (LVR): Indicates that a local variable of class B is created in the method of class A.

[0038] 6) Return type relation (RET): There is at least one method in class A whose return type is class B.

[0039] 7) INStantiates relation (INS): Class A instantiates at least one object of class B.

[0040] 8) Attribute access relationship (filedACCess, ACC): At least one method in class A accesses at least one attribute in class B.

[0041] 9) Method Call relation (MEC): At least one method in class A calls at least one method in class B object.

[0042] In an exemplary embodiment, S2 may be replaced by the following steps.

[0043] S21: The weight of each coupling type is determined based on an experimental weighting method.

[0044] S22: Determine the coupling strength between the two classes according to the weight of the coupling type.

[0045] S23: constructing a quasi-coupling network according to the coupling strength.

[0046] In an exemplary embodiment, S22 may be replaced by the following steps.

[0047] use Determines the coupling strength between two classes; where w ij For directed edges<i,j> The edge weight, w ij It is used to abstract the coupling strength between class node i and class node j; r is the coupling type; is the frequency of coupling type r between class node i and class node j; w r is the weight of coupling type r.

[0048] Furthermore, the calculation of edge weights of the software network CCN specifically includes the following sub-steps:

[0049] 1.1) CCN is a weighted network, which is associated with a weight matrix ψ. Any element ψ in ψ ij The definition is as follows:

[0050]

[0051] Where L is the set of directed edges in CCN; w ij It is a directed edge<i,j> The edge weight is used to abstract the coupling strength between class nodes i and j. The larger the edge weight, the greater the coupling strength between the corresponding classes.

[0052] 1.2) Calculate the coupling strength w between two classes ij When , the present application accumulates the strengths generated by different types of coupling, i.e., the coupling strength w ij The calculation formula is as follows:

[0053]

[0054] Among them, r = {INH, IMP, PAR, GVR, LVR, RET, INS, ACC, MEC} are nine coupling types; is the frequency of coupling of type r between class i and class j, and its value can be determined by analyzing the software structure information collected by static analysis; r is the weight of coupling type r. Therefore, w ij The key is to determine w r The value of .

[0055] 1.3) In order to obtain the weight w of coupling type r r This application is approved by et al. proposed an experimental weighting method, the Empirical Weighting Mechanism (EWM). r Assignment. In this method, the weights of different types of coupling are obtained when they do software reconstruction experiments, that is, the weights of different types of coupling corresponding to the optimal results of the software reconstruction experiment. Table 1 is a table of weighted mechanisms proposed by Sora et al., and the weighted results are shown in Table 1.

[0056] Table 1

[0057] Weight Coupling type 4 IMP 3 INH, PAR, RET, GVR 2 MEC,ACC,INS 1 LVR

[0058] In an exemplary embodiment, S3 may be replaced by the following steps.

[0059] S31: For any type of node i in the class coupling network, calculate the relative importance of the type of node i.

[0060] S32: Calculate the probability that the importance of class node j is transferred to class node i.

[0061] S33: Calculate the indirect influence of class node j on class node i according to the probability of class node j's importance being transferred to class node i, the relative importance of class node i, and the relative importance of class node j.

[0062] S34: Calculate the gravitational entropy index value of the class node i according to the indirect influence.

[0063] Furthermore, the calculation of the gravitational entropy index value GEN(i) of class node i specifically includes the following sub-steps:

[0064] 2.1) For any class node i in CCN, calculate the relative importance of the class node from the perspective of entropy IE i ,Right now:

[0065]

[0066]

[0067]

[0068] Among them, deg i represents the weighted degree of class node i, that is, the sum of the edge weights of the edges connected to node i in CCN; sib(i) represents the set of class node i and its 1-order neighbor nodes; x is any class node in sib(i); P irepresents the ratio of the weighted degree of node i to the total weighted degree of nodes in its 1-order domain, which describes the relative importance of node i in its 1-order domain; in(i) represents the set of neighbor nodes on the incoming edge of type i in CCN; v is any type of node in in(i); lnP v YesP v The natural logarithm of i Indicates P v entropy; on(v) represents the set of neighbor nodes on the outgoing edge of class v in CCN; u is any type of node in on(v); w vi Represents a directed edge<v,i> The edge weight; V is the node set of CCN; e v The calculation method is the same as e i Similar, that is, P k The entropy, P k is the ratio of the weighted degree of class node k to the total weighted degrees of nodes in the 1-order domain of class node k, class node k is the class node in in(v), in(v) is the set of neighbor nodes on the incoming edge of class node v in the class coupling network.

[0069] 2.2) Calculate the probability that the importance of class node j is transferred to class node i Right now:

[0070]

[0071] Among them, d i,j represents the shortest path length between node i and node j; represents the distance between node i and node j i,j The number of order paths; V is the node set of CCN; h is any type of node in V; represents the distance between node j and all other nodes. i,j The total number of paths of order. Therefore, What is actually quantified is the distance d from node i to node j. i,j The number of order paths accounts for the distance from node j to all other nodes. i,j The ratio of the number of order paths. The larger the value, the easier it is for node j to transfer its importance to node i than other nodes.

[0072] 2.3) Based on the probability of transferring the importance of class node j obtained in step 2.2) to class node i and the relative importance values ​​IE of class i and class j obtained in step 2.1) i , IE j , calculate the indirect influence INF of node j on node i i,j ,Right now:

[0073]

[0074] Among them, d i,j represents the shortest path length between node i and node j; Represents the probability that the importance of node j is transferred to node i; IE i is the importance value of class i calculated from the entropy perspective.

[0075] 2.4) Based on the indirect influence INF of node j on node i obtained in step 2.3) i,j , calculate the gravitational entropy index value GEN(i) of node i, that is:

[0076]

[0077] Where GEN(i) represents the gravitational entropy of node i; sib3(i) represents the set of all nodes whose shortest path length to node i is less than or equal to 3; j is any type of node in sib3(i); INF i,j Represents the indirect influence of node j on node i.

[0078] The following code is taken as an example to illustrate the technical solution of this application.

[0079] (1) The source code of Java software is analyzed through static analysis technology to parse out various software elements (classes, interfaces, attributes, methods, local variables, etc.) and coupling types between elements (inheritance relationships between classes, implementation relationships between classes and interfaces, calling relationships between methods, etc.), and the extracted information is abstracted into nodes and edges in CCN to construct a software network CCN = (V, L).

[0080] The following is a snippet of the Java source code for the software:

[0081]

[0082] Through static analysis technology, the CCN software network corresponding to the software code is parsed. Figure 2 As shown in the figure, V = {Animal, Home, Mammal, Zoo, Monkey}, which represents the set of various software element nodes in the software code.

[0083] (2) Construct the edges of the software network CCN based on the Java source code. From the code, we can see that Mammal implements Animal, which means that there is an implementation relationship (IMP) between the Mammal and Animal nodes; Monkey inherits Mammal, which means that there is an inheritance relationship (INH) between the Monkey and Mammal nodes; there is a method getAnimal() in Zoo whose return type is Animal, which means that there is a return type relationship (RET) between Zoo and Animal; the getAnimal() method in Zoo instantiates Monkey, which means that there is an instantiation relationship (INS) between Zoo and Monkey; there is a method addAnimal() in Zoo whose parameter is Mammal, which means that there is a parameter relationship (PAR) between Zoo and Mammal; Home contains an A Animal type attributes, so there is a global variable relationship (GVR) between Home and Animal; a method adoptAnimal() in Home creates the Zoo class, indicating a local variable relationship (LVR) between Home and Zoo; Zoo is instantiated in Home's adoptAnimal(), indicating an instantiation relationship (INS) between Home and Zoo; an attribute of Animal type is called once in Home's adoptAnimal(), indicating an attribute access relationship (ACC) between Home and Animal; the getAnimal() method of the Zoo class is called in Home's adoptAnimal(), so there is a method call relationship (MEC) between Home and Zoo. The above relationships will be abstracted as edges in CCN, and L = {(Home,Animal), (Mammal,Animal), (Zoo,Animal), (Home,Zoo), (Zoo,Mammal), (Zoo,Monkey), (Monkey,Mammal)}, which represents the coupling type between various software elements.

[0084] (3) The calculation of edge weights of the software network CCN specifically includes the following sub-steps:

[0085] (3.1) Using EWM to assign weights to different types of coupling types, we can get r LVR =1, r MEC =r ACC =r INS =2, r INH =r PAR =r RET =r GVR =3, r IMP =4.

[0086] (3.2) According to the coupling type weight obtained in step (3.1), the coupling strength w between the two classes is calculated ij , the intensities generated by different types of coupling are accumulated, that is, the coupling intensity w ij The calculation formula is as follows:

[0087]

[0088] Among them, r = {INH, IMP, PAR, GVR, LVR, RET, INS, ACC, MEC} are nine coupling types; is the frequency of coupling of type r between class i and class j, and its value can be determined by analyzing the software structure information collected by static analysis; r is the weight of the coupling type r. Therefore, Figure 2 The coupling strength w between the classes corresponding to both ends of all edges in BA =1×r GVR +1×r ACC =5,w BD =1×r LVR +1×r INS +1×r MEC =5,w CA =1×r IMP =4,w DA =1×r RET =3,w DC =1×r PAR =3,w DE =1×r INS =2,w EC =1×r INH =3.

[0089] (4) Based on the CCN constructed in steps (1), (2), and (3), calculate the gravitational entropy index value GEN(i) of all class nodes i and use it as the importance value of the corresponding class of node i. The calculation of GEN(i) specifically includes the following sub-steps:

[0090] (4.1) For any class node i in CCN, the relative importance of the class node is calculated from the entropy perspective: IE i ,Right now:

[0091]

[0092]

[0093]

[0094] Among them, deg irepresents the weighted degree of class node i (i.e., the sum of the edge weights of the edges connected to node i in CCN); sib(i) represents the set of node i and its 1-order neighbor nodes; x is any class node in sib(i); P i represents the ratio of the weighted degree of node i to the total weighted degree of nodes in its 1-order domain; in(i) represents the set of neighbor nodes on the incoming edge of class i in CCN; v is any class of node in in(i); lnP v YesP v The natural logarithm of i Indicates P v entropy; on(v) represents the set of neighbor nodes on the outgoing edge of class v in CCN; u is any type of node in on(v); w vi Represents a directed edge<v,i> The edge weight of ; V is the node set of CCN.

[0095] therefore, Figure 2 P of all nodes in i for: The same can be said

[0096] Figure 2 e of all nodes in i For: e A =-P B LqCy B -P C LqCy C -P D LqCy D =0.86, and similarly we can get e B =0,e C =0.62, e D =0.35, e E =0.25.

[0097] Figure 2 IE of all nodes in i for: The same can be said for IE B =0,IE C =1.00,IE D =0.35,IE E =0.34.

[0098] (4.2) Calculate the probability that the importance of class node j is transferred to class node i Right now:

[0099]

[0100] Among them, d i,j represents the shortest path length between node i and node j; represents the distance between node i and node j i,j The number of order paths; V is the node set of CCN; h is any type of node in V; represents the distance between node j and all other nodes. i,j The total number of paths.

[0101] therefore, Figure 2 The probability of importance transfer between all the nodes at both ends of the edge is: Because the shortest path length between node A and node B is 1, so d A,B =1, Similarly,

[0102] (4.3) The probability of transferring the importance of class node j obtained in step (4.2) to class node i And the relative importance values ​​IE of class i and class j obtained in step (4.1) i , IE j , calculate the indirect influence INF of node j on node i i,j ,Right now:

[0103]

[0104] Among them, d i,j represents the shortest path length between node i and node j; It represents the probability that the importance of node j is transferred to node i.

[0105] therefore, Figure 2 The indirect influence of all nodes j on node i is: Similarly, INF A,D =0.14, INF A,E =0.05, INF B,C =0,INF B,D =0,INF B,E =0,INF C,D =0.09, INF C,E =0.17, INF D,E =0.06.

[0106] (4.4) Based on the indirect influence of node j on node i obtained in step (4.3), INF i,j , calculate the gravitational entropy index value GEN(i) of node i, that is:

[0107]

[0108] Where GEN(i) represents the gravitational entropy of node i; sib3(i) represents the set of all nodes whose shortest path length to node i is less than or equal to 3; j is any type of node in sib3(i); INF i,j Represents the indirect influence of node j on node i.

[0109] Figure 2 The gravitational entropy of all nodes in is: GEN(A)=INF A,B +INF A,C +INF A,D +INF A,E =0.73, GEN(B)=0, GEN(C)=0.80, GEN(D)=0.83, GEN(E)=0.28.

[0110] (5) Based on the gravitational entropy (GEN) values ​​of all class nodes obtained in step (4), the class nodes are sorted in descending order, and the top-15% classes are used as the identified key classes. Based on the results of step (4.4), the ranking results are (D: 0.83) > (C: 0.80) > (A: 0.73) > (E: 0.28) > (B: 0). Figure 2 There are 5 class nodes in total, and the top 15% is taken, that is, 5*15%=0.75, which is rounded to 1. Therefore, the top 1 class node D(Zoo) in the sorting result is taken as the key class.

[0111] This application extracts structural information from software source code, constructs a CCN software network, abstracts classes and coupling types between classes; constructs a new metric for measuring class importance - gravitational entropy GEN; calculates the GEN of each class node in CCN as the importance value of the class node; sorts all class nodes in descending order according to the GEN value of the class, and regards classes ranked top-15% (a threshold recognized in the field) as key classes.

[0112] In order to build a more complete software network, this application introduces a detailed analysis of class dependencies, including a comprehensive characterization of dependency types, directions and strengths. Compared with traditional methods that only focus on a few dependency types such as method calls and ignore the direction and strength of dependencies, this application helps to more comprehensively express the software elements and relationships of the software system. The GEN indicator of this application starts from the gravity formula, combined with the entropy in information theory, and considers the influence of indirect (non-contact) coupling between classes and the degree distribution of neighbor nodes on the importance of classes. This application makes up for the shortcomings of existing static key class identification technology, can improve the accuracy of key method identification, is of great significance to improving the efficiency of code understanding and maintenance, and provides technical support for the development of high-trust software.

[0113] In an exemplary embodiment, a computer device is provided, which may be a server or a terminal. The computer device includes a processor, a memory, an input / output interface (I / O for short) and a communication interface. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface is connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store software key class identification data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a software key class identification method is implemented.

[0114] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the above method is implemented when the processor executes the computer program.

[0115] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the above method when executed by a processor.

[0116] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ReadOnlyMemory, ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (Magnetoresistive RandomAccess Memory, MRAM), ferroelectric random access memory (Ferroelectric RandomAccess Memory, FRAM), phase change memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory can include random access memory (RandomAccess Memory, RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0117] In this application, all actions to obtain signals, information or data are carried out in compliance with the relevant data protection laws and policies of the country where they are located and with the authorization given by the owner of the corresponding device.

[0118] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0119] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0120] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A method for identifying software key classes, characterized in that: The software key class identification method comprises: Analyze various software elements in the software source code and the coupling types between the elements; the software element classes, interfaces, attributes, methods and local variables; the coupling types include inheritance relationships between classes, implementation relationships between classes and interfaces, parameter relationships, global variable relationships, local variable relationships, return type relationships, instantiation relationships, attribute access relationships and calling relationships between methods; Construct a class coupling network based on various software elements and the coupling types between them; Constructing a gravitational entropy index according to the class coupling network, and calculating the gravitational entropy index values ​​of all class nodes in the class coupling network; Sorting all class nodes according to the gravitational entropy index value to generate a class node sequence; Based on the class node sequence, key software classes are identified.

2. The method for identifying software key classes according to claim 1, characterized in that: According to various software elements and the coupling types between elements, a class coupling network is constructed, including: The weight of each coupling type is determined by an experimentally based weighting method; Determining the coupling strength between two classes according to the weight of the coupling type; A quasi-coupled network is constructed according to the coupling strength.

3. The method for identifying software key classes according to claim 2, characterized in that: Determining the coupling strength between two classes according to the weight of the coupling type specifically includes: use Determines the coupling strength between two classes; where w ij For directed edges<i,j> The edge weight, w ij It is used to abstract the coupling strength between class node i and class node j; r is the coupling type; is the frequency of coupling type r between class node i and class node j; w r is the weight of coupling type r.

4. The method for identifying software key classes according to claim 1, characterized in that: Constructing a gravitational entropy index according to the class coupling network, and calculating the gravitational entropy index values ​​of all class nodes in the class coupling network, specifically including: For any type of node i in the class coupling network, calculate the relative importance of the type of node i; Calculate the probability that the importance of class node j is transferred to class node i; According to the probability of class node j's importance being transferred to class node i, the relative importance of class node i, and the relative importance of class node j, the indirect influence of class node j on class node i is calculated; The gravitational entropy index value of the node i is calculated according to the indirect influence.

5. The method for identifying software key classes according to claim 4, characterized in that: For any type of node i in the class coupling network, the relative importance of the type of node i is calculated, specifically including: use Calculate the relative importance of node i of this type; where IE i is the relative importance of class node i; e i P v The entropy, P v is the ratio of the weighted degree of class node v to the total weighted degree of nodes in the 1-order domain of class node v, class node v is the class node in in(i), in(i) is the set of neighbor nodes on the incoming edge of class node i in the class coupling network; w vi For directed edges<v,i> ; V is the class node set of the class coupling network; class node u is the class node in on(v), and on(v) is the neighbor node set on the outgoing edge of class v in the class coupling network; e v P k The entropy, P k is the ratio of the weighted degree of class node k to the total weighted degrees of nodes in the 1-order domain of class node k, class node k is the class node in in(v), in(v) is the set of neighbor nodes on the incoming edge of class node v in the class coupling network.

6. The method for identifying software key classes according to claim 4, characterized in that: Calculate the probability that the importance of class node j is transferred to class node i, including: use Calculate the probability that the importance of class node j is transferred to class node i Among them, d i,j is the shortest path length between class node i and class node j; is the distance between class node i and class node j i,j The number of order paths; V is the class node set of the class coupling network; h is any class node in V; is the distance between class node j and all nodes i,j The total number of paths.

7. The method for identifying software key classes according to claim 4, characterized in that: According to the probability of class node j's importance being transferred to class node i, the relative importance of class node i, and the relative importance of class node j, the indirect influence of class node j on class node i is calculated, including: use Calculate the indirect influence of class node j on class node i; where INF i,j is the indirect influence of class node j on class node i; is the probability that the importance of class node j is transferred to class node i; d i,j is the shortest path length between class node i and class node j; IE i is the relative importance of class node i; IE j is the relative importance of class node j.

8. The method for identifying software key classes according to claim 4, characterized in that: Calculating the gravitational entropy index value of class node i according to the indirect influence includes: use Calculate the gravitational entropy index value GEN(i) of class node i; where sib3(i) is the set of all class nodes whose shortest path length with class node i is less than or equal to 3; j is any class node in sib3(i); INF i,j Represents the indirect influence of class node j on class node i.

9. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the software critical class identification method according to any one of claims 1 to 8.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for identifying key software classes described in any one of claims 1 to 8 is implemented.