CN103853554A - Software reconstruction position determination method and software reconstruction position identification device - Google Patents

Software reconstruction position determination method and software reconstruction position identification device Download PDF

Info

Publication number
CN103853554A
CN103853554A CN201410058144.2A CN201410058144A CN103853554A CN 103853554 A CN103853554 A CN 103853554A CN 201410058144 A CN201410058144 A CN 201410058144A CN 103853554 A CN103853554 A CN 103853554A
Authority
CN
China
Prior art keywords
elements
dependency
dependence
oriented systems
dependence value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410058144.2A
Other languages
Chinese (zh)
Inventor
张重峰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Datang Mobile Communications Equipment Co Ltd
Original Assignee
Datang Mobile Communications Equipment Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Datang Mobile Communications Equipment Co Ltd filed Critical Datang Mobile Communications Equipment Co Ltd
Priority to CN201410058144.2A priority Critical patent/CN103853554A/en
Publication of CN103853554A publication Critical patent/CN103853554A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses a software reconstruction position determination method and a software reconstruction position identification device, which relate to the computer field. After program slicing is carried out on software, a dependency value between each two elements of corresponding granularity is determined according to an object-oriented system dependency graph, the dependency between the two elements is then determined, at least one of the elements needs to be reconstructed if the dependency between the two elements reaches set conditions and the two elements are not in the same module, and therefore the effective identification of the place requiring reconstruction in the software is realized.

Description

A kind of software reconfiguration location determining method and device
Technical field
The present invention relates to computer software fields, relate in particular to a kind of software reconfiguration location determining method and device.
Background technology
Reconstruct refers to that software code is done to any change does not affect Output rusults to increase readability or simplified structure.In Extreme Programming or other Agile methodologies, reconstruct is usually a part for software development circulation: developer increases new test and function in turn, and reconfiguration code is promoted inner clarity and consistance.
Reconstruct neither corrects mistakes, and does not increase again new functionally, is for improving the readable of code or changing code inner structure and design, and removes dead code, makes it in the future more easily maintained.
Reconfiguration code can be the reconstruct of structural level or meaning of one's words aspect, when different reconstruct means are implemented, may be the adjustment of structure or the conversion of the meaning of one's words, but prerequisite is not affect the behavior of code before and after conversion.Particularly, under the structure of existing program, increasing a new behavior to a program may be very difficult, and therefore this part code of the first reconstruct of developer's possibility, makes to add new behavior to become easy.
In recognizer which place exist unreasonable, which code need to be reconstructed is the difficult point of reconstruct, because depend on several factors for irrational understanding, has to a great extent subjectivity.Therefore, how automatically to identify reconstruct to liking the bottleneck of restriction reconfiguration technique development.At present, mainly rely on artificial cognition, so not only efficiency is low, and correctness is not high, thereby has restricted the development of reconfiguration technique.Therefore, automatically identify reconstruct object extremely important to the development of reconfiguration technique.
One of method of identification reconstruct object is static analysis.First the people such as Kamiya propose a kind of technology of automatic identification clone code, and this is the blank of robotization identification reconstruct object.They,, by some rules, convert token(symbol to source program), then analyze these token, therefrom find out clone's code.According to the thought of this static analysis, they develop the instrument that can automatically identify clone's code, and this is a kind of instrument of early stage automatic identification reconstruct object.The people such as Kataoka utilize dynamic analysis technology, develop can autotest in the instrument of invariant, it instructs target program to remove to follow the tracks of some interest variablees, then on these variablees, moves some protos test suite PROTOSs, finally infers which variable is invariant.
Measurement technology is also the important method of reconstruct identification.As the code line tolerance of the propositions such as Chidamber can reflect tightness degree mutual between a method in class and attribute.Briand etc. propose a kind of tolerance of the interface for class, analyze interface definition whether reasonable of this class.Sheetz etc. measure by fan-out, react a class and the extraneous degree of coupling, and this can help in recognizer unreasonable part mutual between class.These methods all can be used to the unreasonable part in standby maintenance personal identification program.
But what static analysis can only be static analyzes existing code, and state that can not routine analyzer operation stream, therefore can identify some clone's code or irrational codes, and can not directly support reconstruct.This need to add empirical analysis, further identifies and can utilize which kind of reconfiguration technique to adjust existing code.
Information when although dynamic analysis technology adds program operation, it is limited to the reconstruct of identifying invariant, and other reconstruct are not well supported.And this reconfiguration technique is in application process, for reducing software complexity, the support that improves the internal soundness of software is not very desirable, to the DeGrain that improves of software.
Summary of the invention
The embodiment of the present invention provides a kind of software reconfiguration location determining method and device, identifies preferably with the place of realizing needing reconstruct in software.
A kind of software reconfiguration location determining method that the embodiment of the present invention provides, comprising:
Software program is set the program slice of granularity on procedure dependency figure or system dependence graph, obtained and there are multiple nodes and represent the Object-Oriented Systems dependency graph of the access path of internodal dependence;
According to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be access path included in the internodal shortest path that two elements are corresponding weights and;
Determine the dependency degree between each element according to described dependence value;
Determining that two dependency degrees between element reach imposes a condition and two elements not in the same module of software time, determines that at least one element wherein need to be reconstructed.
Software is being carried out after program slice, determine the dependence value between every two elements of corresponding granularity according to Object-Oriented Systems dependency graph, and then determine the dependency degree between two elements, if the dependency degree between two elements reach impose a condition and two elements not in same module, can determine that at least one element wherein need to be reconstructed, and then realize the place that needs reconstruct in software is identified preferably.
Further, in order to improve the accuracy of determined dependence value, described according to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be access path included in the internodal shortest path that two elements are corresponding weights with front, also comprise:
Determine and will determine that two elements of dependence value are elements A and element B;
Determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B be in the backward slicing of elements A a bit; Or all descendant nodes of determining elements A in Object-Oriented Systems dependency graph all pass through elements A to the path of element B.
Further, in order to improve the accuracy of determined dependence value, also comprise:
Determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B is not while being some in the backward slicing of elements A, determines that dependence value between elements A and element B is for just infinite;
Determine that elements A has descendant node in Object-Oriented Systems dependency graph, each descendant node that the dependence value between definite elements A and element B is elements A is to the arithmetic mean value of the dependence value of B.
Further, describedly determine the dependency degree between each element according to described dependence value, specifically comprise:
Determine and will determine that two elements of dependency degree are elements A and element B;
In the time that elements A does not have descendant node, determine that elements A is the inverse of the dependence value between elements A and element B to the dependency degree of element B; In the time that elements A has descendant node, determine each descendant node that elements A is elements A to the dependency degree of element B to the reciprocal of the dependence value of B and.
Concrete, the dependency degree of described definite two elements reaches and imposes a condition, and is specially:
Determine that two dependency degrees between element reach setting threshold; Or
Determine that the dependency degree between any element and other the each element in two elements is all less than the dependency degree between another element in this element and two elements.
A kind of software reconfiguration position identification device, comprising:
Section unit, for software program being set the program slice of granularity on procedure dependency figure or system dependence graph, obtains and has multiple nodes and represent the Object-Oriented Systems dependency graph of the access path of internodal dependence;
The first determining unit, for according to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be link path included in the internodal shortest path that two elements are corresponding weights and;
The second determining unit, for determining the dependency degree between each element according to described dependence value;
The 3rd determining unit, for determine dependency degree between two elements reach impose a condition and two elements not when the same module of software, determine that at least one element wherein need to be reconstructed.
This device is carrying out after program slice software, determine the dependence value between every two elements of corresponding granularity according to Object-Oriented Systems dependency graph, and then determine the dependency degree between two elements, if the dependency degree between two elements reach impose a condition and two elements not in same module, can determine that at least one element wherein need to be reconstructed, and then realize the place that needs reconstruct in software is identified preferably.
Further, in order to improve the accuracy of determined dependence value, described the first determining unit also for:
According to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be link path included in the internodal shortest path that two elements are corresponding weights with front, determine and will determine that two elements of dependence value are elements A and element B, determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B be in the backward slicing of elements A a bit; Or all descendant nodes of determining elements A in Object-Oriented Systems dependency graph all pass through elements A to the path of element B.
Further, in order to improve the accuracy of determined dependence value, described the first determining unit also for:
Determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B is not while being some in the backward slicing of elements A, determines that dependence value between elements A and element B is for just infinite;
Determine that elements A has descendant node in Object-Oriented Systems dependency graph, each descendant node that the dependence value between definite elements A and element B is elements A is to the arithmetic mean value of the dependence value of B.
Further, described the second determining unit specifically for:
Determine and will determine that two elements of dependency degree are elements A and element B;
In the time that elements A does not have descendant node, determine that elements A is the inverse of the dependence value between elements A and element B to the dependency degree of element B; In the time that elements A has descendant node, determine each descendant node that elements A is elements A to the dependency degree of element B to the reciprocal of the dependence value of B and.
Concrete, described the 3rd determining unit is determined that the dependency degree of two elements reaches and is imposed a condition, is specially:
Determine that two dependency degrees between element reach setting threshold; Or
Determine that the dependency degree between any element and other the each element in two elements is all less than the dependency degree between another element in this element and two elements.
The embodiment of the present invention provides a kind of software reconfiguration location determining method and device, software is being carried out after program slice, determine the dependence value between every two elements of corresponding granularity according to Object-Oriented Systems dependency graph, and then determine the dependency degree between two elements, if the dependency degree between two elements reach impose a condition and two elements not in same module, can determine that at least one element wherein need to be reconstructed, and then realize the place that needs reconstruct in software is identified preferably.
Brief description of the drawings
The software reconfiguration location determining method process flow diagram that Fig. 1 provides for the embodiment of the present invention;
The system dependence graph of the example one that Fig. 2 provides for the embodiment of the present invention;
The system dependence graph of the example two that Fig. 3 provides for the embodiment of the present invention;
The software reconfiguration position identification device structural representation that Fig. 4 provides for the embodiment of the present invention.
Embodiment
The embodiment of the present invention provides a kind of software reconfiguration location determining method and device, software is being carried out after program slice, determine the dependence value between every two elements of corresponding granularity according to Object-Oriented Systems dependency graph, and then determine the dependency degree between two elements, if the dependency degree between two elements reach impose a condition and two elements not in same module, can determine that at least one element wherein need to be reconstructed, and then realize the place that needs reconstruct in software is identified preferably.
As shown in Figure 1, the embodiment of the present invention provides a kind of software reconfiguration location determining method, comprising:
Step S101, software program is set the program slice of granularity on procedure dependency figure or system dependence graph, obtained and there are multiple nodes and represent the Object-Oriented Systems dependency graph of the access path of internodal dependence;
Step S102, according to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be access path included in the internodal shortest path that two elements are corresponding weights and;
Step S103, determine the dependency degree between each element according to dependence value;
Step S104, determine that two dependency degrees between element reach and impose a condition and two elements not in the same module of software time, determine that at least one element wherein need to be reconstructed.
Conventionally,, if the dependency degree between two elements is larger, conventionally these two elements are arranged in same module more rationally, if not in same module, can determine that at least one in these two elements is irrational, need to be reconstructed.
Whether wherein, dependency degree can determine by whether being greater than setting threshold more greatly, also can relatively largely by determine, for example, can determine the dependency degree of element B and all elements, if the dependency degree maximum of element B and elements A determines that the dependency degree between elements A and element B is larger.
Concrete, the process of carrying out program slice is as follows:
First constructor dependency graph (PDG) or system dependence graph (SDG), then according to given section criterion, application drawing accessibility algorithm on PDG, or on SDG, use the figure accessibility algorithm of two step traversals to carry out program slice.In the embodiment of the present invention, can be in single process when calculation procedure section, add some limits that represent interprocedual dependence (calling limit, parameter input limit and parameter output limit), the algorithm of calculation procedure section is expanded to interprocedual in process, and add again some to describe the limit of OO characteristic, form Object-Oriented Systems dependency graph (OOSDG), then utilize the figure accessibility algorithm of two step traversals to carry out calculation procedure section.
Carrying out after program slice, determine the dependence value between every two elements of corresponding granularity according to Object-Oriented Systems dependency graph, for explaining conveniently, use SP (A → B) to be illustrated in the shortest path of system dependence graph mid point A to B, if B is in the backward slicing of A, A equals SP (A → B) to the independent path of B so; Otherwise A is empty to the independent path of B.
Now, elements A to the independent path of B is:
DP(A→B)=
Figure BDA0000467901920000074
B ∈ Backward-Slice (A) represents that element B is in the backward slicing of elements A, element B be in the backward slicing of elements A a bit,
Figure BDA0000467901920000075
represent that element B is not in the backward slicing of elements A, element B be not in the backward slicing of elements A a bit.
In Object-Oriented Systems dependency graph, the fillet between element is divided three classes: the fillet between fillet, method in method and the fillet between class.Fillet in method refers at statement of a method to the limit between another statement, as data dependence edge and control dependence edge etc.; Fillet between method refers to the limit of calling in a method invoked procedure between place's statement and called method, as calls limit, parameter input limit and parameter output limit etc.; Fillet between class refers to the limit of describing relation between class and classes relation, the interior member relation of class and class and example, as inherited limit, class members's method and member variable dependence edge, class example dependence edge etc.Independent path is made up of the limit of above three kinds of forms, if give the respectively in addition weight of limit of three kinds of forms, if the fillet weight between class is 3, the fillet weight between method is 2, fillet weight in method is 1, and dependence value so just equals the weight sum on the limit on independent path.
Using A as focus, and in system dependence graph A without descendant node, if B be in the backward slicing of A a bit, so A to the dependence value of B equal A to the weight of the independent path of B with; If B be not in the backward slicing of A a bit, A equals ∞ to the dependence value of B so:
D(A→B)=
∞ B ∉ Backward - Slice ( A ) | DP ( A → B ) | B ∈ Backward - Slice ( A )
Thus, can infer: in the time calculating A to the dependence value of B, if A has descendant node, establishing the node set that can arrive B in these descendant nodes is E (A), and A equals each node in E (A) arithmetic mean to the dependence value of B to the dependency degree of B so:
D ( A → B ) = Σ D ( E ( A ) → B ) n
Wherein, n is the number of node in E (A).
Thus, can also infer: in the time calculating A to the dependence value of B, in Object-Oriented Systems dependency graph, if all descendant node Ci of A pass through A to the path of B, D (A → B) so=| DP (A → B) |.
Step S102, according to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be access path included in the internodal shortest path that two elements are corresponding weights with front, also comprise:
Determine and will determine that two elements of dependence value are elements A and element B;
Determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B be in the backward slicing of elements A a bit; Or all descendant nodes of determining elements A in Object-Oriented Systems dependency graph all pass through elements A to the path of element B.
Further, the method also comprises:
Determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B is not while being some in the backward slicing of elements A, determines that dependence value between elements A and element B is for just infinite;
Determine that elements A has descendant node in Object-Oriented Systems dependency graph, each descendant node that the dependence value between definite elements A and element B is elements A is to the arithmetic mean value of the dependence value of B.
Dependence value is a kind of tolerance that shows intuitively dependence between element, is not easy to directly be used for identifying reconstruct object.Because in the time calculating A to the dependence value of B, if A has descendant node, and in the descendant node of A, there is a node N, there is not the path of B in N, and there is the path of B in other descendant nodes of A, D (A → B)=∞ so, but this does not correctly represent the dependence between A and B.
But, can be worth to determine two dependency degrees between element according to dependence.
The embodiment of the present invention provides a kind of mode that is worth to determine two dependency degrees between element according to dependence, now, in step S103, determines the dependency degree between each element according to dependence value, specifically comprises:
Determine and will determine that two elements of dependency degree are elements A and element B;
In the time that elements A does not have descendant node, determine that elements A is the inverse of the dependence value between elements A and element B to the dependency degree of element B; In the time that elements A has descendant node, determine each descendant node that elements A is elements A to the dependency degree of element B to the reciprocal of the dependence value of B and.
In Object-Oriented Systems dependency graph, if elements A depends on element B, taking A as focus, just represent that to the dependency degree of B A depends on the degree of B with A.It and dependence value are inversely proportional to, and A is less to the dependence value of B, show that A depends on the degree of B higher; Otherwise, show that A depends on the degree of B lower.
Using A as focus, in Object-Oriented Systems dependency graph, if A does not have descendant node, A equals the inverse of A to the dependence value of B to the dependency degree of B; If A has descendant node, A equals A immediate successor node to the dependency degree of B to the inverse of the dependence value of B and,
Figure BDA0000467901920000091
Can infer, if A does not have descendant node, and
Figure BDA0000467901920000092
, so if all descendant nodes of A all can not arrive B, dependency (A → B)=0 so; If A has unique descendant node C can arrive B, so dependency (A → B)=dependency (C → B).
Visible, dependency degree has solved the incorrect situation that above-mentioned dependence value occurs.In the time calculating A to the dependency degree of B, if A has descendant node, and in the descendant node of A, there is a node N, there is not the path of B in N, and there is the path of B in other descendant nodes of A, dependency (A → B) ≠ 0 so, can correctly reflect the dependence between A and B.
Determine after the dependency degree between element, can represent the dependency degree between element between two by matrix, also can otherwise represent.
Because the dependency degree between two elements is when larger, it is more reasonable that these two elements are arranged in same module, if not in same module, can determine that at least one in these two elements is irrational, need to be reconstructed, when reconstruct, two elements can be arranged in same module.Whether wherein, dependency degree can determine by whether being greater than setting threshold more greatly, also can relatively largely by determine, for example, can determine the dependency degree of element B and all elements, if the dependency degree maximum of element B and elements A determines that the dependency degree between elements A and element B is larger.
Now, in step S104, the dependency degree of fixed two elements reaches and imposes a condition, and is specially:
Determine that two dependency degrees between element reach setting threshold; Or
Determine that the dependency degree between any element and other the each element in two elements is all less than the dependency degree between another element in this element and two elements.
Concrete, for Move Method(moving method), Extract Class(proposes class), the embedded class of Inline Class() object of these 3 kinds of reconstruct, be elaborated respectively, the identification of each reconstruct object is identified according to following steps:
Step 1: draw system dependence graph according to source program;
Step 2: determine element set CO;
Step 3: calculate the dependency degree between each element in CO, and result matrix representation;
Step 4: result is analyzed to the element that identification need to be reconstructed.If A is high to the dependency degree of B, but A and B be in same module, and B need to be reconstructed.
Step 5: the element B that needs are reconstructed is implemented reconstruct, and element B is moved in the module under A.
1) Move Method reconstruct object identification
Move Method reconstruct is certain method in a class, moves in another new class being more applicable to.So CO set should comprise methods all in class.Because method may be called other method or use some attributes, so also will being added to CO, these methods and attribute concentrate again.
Determine which class is a method should be assigned to, and that is to say, if method M ito class C jdependency degree high, just should be M ireadjust such C jin.Therefore, need to calculate each method M ito each class C jdependency degree dependency (M i→ C j), according to result of calculation, observe which method M ito class C jdependency degree maximum, just M idistribute to class C jamong.
2) Extract/Inline Class reconstruct object identification
Extract Class reconstruct is that the group element in a class A is extracted in a new class B, and the degree of interdepending between the element that this group is extracted is higher.Inline Class is embedded into a class B in another class A, and the element in class B is high to the dependency degree of class A.These 2 reconstruct Reverse reconstruction each other, its object is all in order to reduce the degree of coupling between class.Herein taking Extract Class as main study subject.
Identify the object of Extract Class reconstruct, need to find out one group of element that dependency degree is high, this group element should have following characteristics: the dependency degree between group interior element is high, between them, interdepends; And group interior element is low with the dependency degree of group between outer element, close to zero, organizing interior element and organizing between outer element does not almost have dependence.The embodiment of the present invention provides a kind of grouping algorithm (push element into group based on control is called for short PEG-C algorithm) to identify the reconstruct object of Extract Class, and this algorithm is as follows:
Figure BDA0000467901920000111
The software reconfiguration location determining method embodiment of the present invention being provided below by some examples is elaborated:
Figure BDA0000467901920000122
Figure BDA0000467901920000131
The CO set of this example should comprise the attribute that method in all classes and these methods are used.Property for simplicity, removes some nonuseable parts in CO because setGraph () method only with this class in attribute mutual, so can not be the object that Move Method studies; AddVertex () and addEdge () have behavioral similarity in addition, so only study addVertex ().The CO={addVertex () finally simplifying, addSDGSwitchStatement (), aNode, aNodeList, aEdge, aEdgeList, activeSDGNode, activeGraph}.
As shown in Figure 2, property for simplicity, only pays close attention to the dependence of tape label statement, and for not having labelled statement, does not show the details of its dependence the Object-Oriented Systems dependency graph of these two classes.
Next, the dependency degree between each element in Object-Oriented Systems dependency graph is calculated.For example, the dependency degree dependency (M2 → S4) between computing node addSDGSwitchStatement () and activeSDGNode.Because have activeSDGNode_in in the descendant node of addSDGSwitchStatement () node, tri-nodes of S3 and activeSDGNode_out can arrive activeSDGNode, so can determine:
dependency ( M 2 - S 4 ) = 1 D ( activeSDGNode _ in → S 4 ) + 1 D ( S 3 → S 4 ) + 1 D ( activeSDGNode _ S 4 ) = 1.83
And for example, dependency degree dependency (M2 → S6) between computing node addSDGSwitchStatement () and aNode, because the descendant node of addSDGSwitchStatement () node has activeSDGNode_in, S3, tetra-nodes of S5 and activeSDGNode_out can arrive aNode, but S5 can not directly arrive aNode, but arrive by its descendant node aNode_out and aNodeList_out, so can determine:
D ( S 5 → S 6 ) = 1 2 { D ( aNode _ out → S 6 ) + D ( aNodeList _ out → S 6 ) } = 4.5 ,
dependcy ( M 2 → S 6 ) = 1 D ( activeSDGNode _ in → S 6 ) + 1 D ( S 3 → S 6 ) + 1 D ( S 5 → S 6 ) + 1 D ( activeSDGNode _ out → S 6 ) = 1.3
According to as above method, the dependency degree dependency of any two element i and j, (i → j) result of calculation of matrix is listed in table 1.
Dependence matrix between table 1Vertex class and SDGSwitchStatement class
Figure BDA0000467901920000142
(i → j)=" * " represents to ignore i and calculates to the dependency degree of j note: dependency.
Finally, calculate the dependency degree dependency (M of each method to each class i→ C j)=Σ kdependency (M i→ E k), wherein E k∈ C j.Make addVertex ()=M 1, addSDGSwitchStatement ()=M 2; Make class Vertex=C 1, SDGSwitchStatement=C 2.So, dependency (M 1→ C 1)=8.48, dependency (M 1→ C 2)=1.15; Dependency (M 2→ C 1)=6.26, dependency (M 2→ C 2)=1.83.Known, addSDGSwitchStatement () method should be moved in class Vertex.
Extract/Inline Class example
First, be analyzed as follows example:
Figure BDA0000467901920000143
Figure BDA0000467901920000151
The CO set of this example should comprise attributes all in class and method, be CO={vertexName, vertexNumber, graphName, getVertexMessage (), getVertexName (), setVertexName (), getVertexNumber (), setVertexNumber (), getGraphName () }.
The Object-Oriented Systems dependency graph of these 2 classes as shown in Figure 3.According to Object-Oriented Systems dependency graph, calculate the dependency degree between each element in CO, result is passed through to rely on matrix display in table 2.
The dependence matrix of table 2Graph class
Figure BDA0000467901920000152
Element is carried out to label according to the order from left to right of rower in matrix, i.e. vertexName=1, vertexNumber=2 ..., getGraphName ()=9.According to PEG-C algorithm, the dependence matrix of above-mentioned example is analyzed: from CO, select the 1st element and put into newClass[1], at this moment only have the 1st element not to be labeled, and be marked as 1 and be marked as 2 element set for empty, calculate according to algorithm substep, end product is newClass[1]={ 1,3,4,5,2,6,7}, newClass[2]={ 8,9}.From result of calculation, attribute vertexName in class Graph, vertexNumber and method getVertexMessage (), getVertexName (), setVertexName (), getVertexNumber (), setVertexNumber () belongs to same group, should be extracted in new class.
The embodiment of the present invention is also corresponding provides a kind of software reconfiguration position identification device, as shown in Figure 4, comprising:
Section unit 401, for software program being set the program slice of granularity on procedure dependency figure or system dependence graph, obtains and has multiple nodes and represent the Object-Oriented Systems dependency graph of the access path of internodal dependence;
The first determining unit 402, for determine according to Object-Oriented Systems dependency graph dependence value between every two elements of corresponding granularity be the included link path of internodal shortest path that two elements are corresponding weights and;
The second determining unit 403, for determining the dependency degree between each element according to dependence value;
The 3rd determining unit 404, for determine dependency degree between two elements reach impose a condition and two elements not when the same module of software, determine that at least one element wherein need to be reconstructed.
Preferably, the first determining unit 402 also for:
According to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be link path included in the internodal shortest path that two elements are corresponding weights with front, determine and will determine that two elements of dependence value are elements A and element B, determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B be in the backward slicing of elements A a bit; Or all descendant nodes of determining elements A in Object-Oriented Systems dependency graph all pass through elements A to the path of element B.
Now, the first determining unit 402 also for:
Determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B is not while being some in the backward slicing of elements A, determines that dependence value between elements A and element B is for just infinite;
Determine that elements A has descendant node in Object-Oriented Systems dependency graph, each descendant node that the dependence value between definite elements A and element B is elements A is to the arithmetic mean value of the dependence value of B.
Concrete, the second determining unit 403 specifically for:
Determine and will determine that two elements of dependency degree are elements A and element B;
In the time that elements A does not have descendant node, determine that elements A is the inverse of the dependence value between elements A and element B to the dependency degree of element B; In the time that elements A has descendant node, determine each descendant node that elements A is elements A to the dependency degree of element B to the reciprocal of the dependence value of B and.
The dependency degree of the 3rd determining unit 404 definite two elements reaches and imposes a condition, and is specially:
Determine that two dependency degrees between element reach setting threshold; Or
Determine that the dependency degree between any element and other the each element in two elements is all less than the dependency degree between another element in this element and two elements.
The embodiment of the present invention also provides a kind of software reconfiguration position identification device, comprising:
Processor, for software program being set the program slice of granularity on procedure dependency figure or system dependence graph, obtains and has multiple nodes and represent the Object-Oriented Systems dependency graph of the access path of internodal dependence; According to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be link path included in the internodal shortest path that two elements are corresponding weights and; Determine the dependency degree between each element according to described dependence value; Determining that two dependency degrees between element reach imposes a condition and two elements not in the same module of software time, determines that at least one element wherein need to be reconstructed.
The embodiment of the present invention provides a kind of software reconfiguration location determining method and device, software is being carried out after program slice, determine the dependence value between every two elements of corresponding granularity according to Object-Oriented Systems dependency graph, and then determine the dependency degree between two elements, if the dependency degree between two elements reach impose a condition and two elements not in same module, can determine that at least one element wherein need to be reconstructed, and then realize the place that needs reconstruct in software is identified preferably.
Those skilled in the art should understand, embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt complete hardware implementation example, completely implement software example or the form in conjunction with the embodiment of software and hardware aspect.And the present invention can adopt the form at one or more upper computer programs of implementing of computer-usable storage medium (including but not limited to magnetic disk memory, CD-ROM, optical memory etc.) that wherein include computer usable program code.
The present invention is with reference to describing according to process flow diagram and/or the block scheme of the method for the embodiment of the present invention, equipment (system) and computer program.Should understand can be by the flow process in each flow process in computer program instructions realization flow figure and/or block scheme and/or square frame and process flow diagram and/or block scheme and/or the combination of square frame.Can provide these computer program instructions to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine, the instruction that makes to carry out by the processor of computing machine or other programmable data processing device produces the device for realizing the function of specifying at flow process of process flow diagram or multiple flow process and/or square frame of block scheme or multiple square frame.
These computer program instructions also can be stored in energy vectoring computer or the computer-readable memory of other programmable data processing device with ad hoc fashion work, the instruction that makes to be stored in this computer-readable memory produces the manufacture that comprises command device, and this command device is realized the function of specifying in flow process of process flow diagram or multiple flow process and/or square frame of block scheme or multiple square frame.
These computer program instructions also can be loaded in computing machine or other programmable data processing device, make to carry out sequence of operations step to produce computer implemented processing on computing machine or other programmable devices, thereby the instruction of carrying out is provided for realizing the step of the function of specifying in flow process of process flow diagram or multiple flow process and/or square frame of block scheme or multiple square frame on computing machine or other programmable devices.
Although described the preferred embodiments of the present invention, once those skilled in the art obtain the basic creative concept of cicada, can make other change and amendment to these embodiment.So claims are intended to be interpreted as comprising preferred embodiment and fall into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification and not depart from the spirit and scope of the present invention the present invention.Like this, if these amendments of the present invention and within modification belongs to the scope of the claims in the present invention and equivalent technologies thereof, the present invention is also intended to comprise these changes and modification interior.

Claims (10)

1. a software reconfiguration location determining method, is characterized in that, comprising:
Software program is set the program slice of granularity on procedure dependency figure or system dependence graph, obtained and there are multiple nodes and represent the Object-Oriented Systems dependency graph of the access path of internodal dependence;
According to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be access path included in the internodal shortest path that two elements are corresponding weights and;
Determine the dependency degree between each element according to described dependence value;
Determining that two dependency degrees between element reach imposes a condition and two elements not in the same module of software time, determines that at least one element wherein need to be reconstructed.
2. the method for claim 1, it is characterized in that, described according to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be access path included in the internodal shortest path that two elements are corresponding weights with front, also comprise:
Determine and will determine that two elements of dependence value are elements A and element B;
Determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B be in the backward slicing of elements A a bit; Or all descendant nodes of determining elements A in Object-Oriented Systems dependency graph all pass through elements A to the path of element B.
3. method as claimed in claim 2, is characterized in that, also comprises:
Determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B is not while being some in the backward slicing of elements A, determines that dependence value between elements A and element B is for just infinite;
Determine that elements A has descendant node in Object-Oriented Systems dependency graph, each descendant node that the dependence value between definite elements A and element B is elements A is to the arithmetic mean value of the dependence value of B.
4. the method for claim 1, is characterized in that, describedly determines the dependency degree between each element according to described dependence value, specifically comprises:
Determine and will determine that two elements of dependency degree are elements A and element B;
In the time that elements A does not have descendant node, determine that elements A is the inverse of the dependence value between elements A and element B to the dependency degree of element B; In the time that elements A has descendant node, determine each descendant node that elements A is elements A to the dependency degree of element B to the reciprocal of the dependence value of B and.
5. the method for claim 1, is characterized in that, the dependency degree of described definite two elements reaches and imposes a condition, and is specially:
Determine that two dependency degrees between element reach setting threshold; Or
Determine that the dependency degree between any element and other the each element in two elements is all less than the dependency degree between another element in this element and two elements.
6. a software reconfiguration position identification device, is characterized in that, comprising:
Section unit, for software program being set the program slice of granularity on procedure dependency figure or system dependence graph, obtains and has multiple nodes and represent the Object-Oriented Systems dependency graph of the access path of internodal dependence;
The first determining unit, for according to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be link path included in the internodal shortest path that two elements are corresponding weights and;
The second determining unit, for determining the dependency degree between each element according to described dependence value;
The 3rd determining unit, for determine dependency degree between two elements reach impose a condition and two elements not when the same module of software, determine that at least one element wherein need to be reconstructed.
7. device as claimed in claim 6, is characterized in that, described the first determining unit also for:
According to Object-Oriented Systems dependency graph, determine dependence value between every two elements of corresponding granularity be link path included in the internodal shortest path that two elements are corresponding weights with front, determine and will determine that two elements of dependence value are elements A and element B, determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B be in the backward slicing of elements A a bit; Or all descendant nodes of determining elements A in Object-Oriented Systems dependency graph all pass through elements A to the path of element B.
8. device as claimed in claim 7, is characterized in that, described the first determining unit also for:
Determine in Object-Oriented Systems dependency graph, elements A is without descendant node, and element B is not while being some in the backward slicing of elements A, determines that dependence value between elements A and element B is for just infinite;
Determine that elements A has descendant node in Object-Oriented Systems dependency graph, each descendant node that the dependence value between definite elements A and element B is elements A is to the arithmetic mean value of the dependence value of B.
9. device as claimed in claim 6, is characterized in that, described the second determining unit specifically for:
Determine and will determine that two elements of dependency degree are elements A and element B;
In the time that elements A does not have descendant node, determine that elements A is the inverse of the dependence value between elements A and element B to the dependency degree of element B; In the time that elements A has descendant node, determine each descendant node that elements A is elements A to the dependency degree of element B to the reciprocal of the dependence value of B and.
10. device as claimed in claim 6, is characterized in that, described the 3rd determining unit is determined that the dependency degree of two elements reaches and imposed a condition, is specially:
Determine that two dependency degrees between element reach setting threshold; Or
Determine that the dependency degree between any element and other the each element in two elements is all less than the dependency degree between another element in this element and two elements.
CN201410058144.2A 2014-02-20 2014-02-20 Software reconstruction position determination method and software reconstruction position identification device Pending CN103853554A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410058144.2A CN103853554A (en) 2014-02-20 2014-02-20 Software reconstruction position determination method and software reconstruction position identification device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410058144.2A CN103853554A (en) 2014-02-20 2014-02-20 Software reconstruction position determination method and software reconstruction position identification device

Publications (1)

Publication Number Publication Date
CN103853554A true CN103853554A (en) 2014-06-11

Family

ID=50861252

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410058144.2A Pending CN103853554A (en) 2014-02-20 2014-02-20 Software reconstruction position determination method and software reconstruction position identification device

Country Status (1)

Country Link
CN (1) CN103853554A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107066314A (en) * 2017-05-24 2017-08-18 成都四象联创科技有限公司 Software reconfiguration method based on Open Framework
CN109814921A (en) * 2019-01-24 2019-05-28 华东师范大学 A kind of software configuration complexity biodegrading process, equipment and storage medium
CN109815153A (en) * 2019-02-19 2019-05-28 北京天诚同创电气有限公司 The static slicing method and apparatus of PLC program and motor start-up and shut-down control program
CN109976802A (en) * 2019-03-31 2019-07-05 东南大学 A kind of software architecture reconstructing method of schema object

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050102615A1 (en) * 2003-11-12 2005-05-12 Manuel Roman Method and apparatus for composing software
CN101873323A (en) * 2010-06-21 2010-10-27 南京邮电大学 Web service platform based on program slicing technique
CN102541592A (en) * 2011-12-16 2012-07-04 大唐移动通信设备有限公司 Communication device and method for updating software thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050102615A1 (en) * 2003-11-12 2005-05-12 Manuel Roman Method and apparatus for composing software
CN101873323A (en) * 2010-06-21 2010-10-27 南京邮电大学 Web service platform based on program slicing technique
CN102541592A (en) * 2011-12-16 2012-07-04 大唐移动通信设备有限公司 Communication device and method for updating software thereof

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张重峰 等: "基于切片度量的重构对象识别", 《东南大学学报》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107066314A (en) * 2017-05-24 2017-08-18 成都四象联创科技有限公司 Software reconfiguration method based on Open Framework
CN109814921A (en) * 2019-01-24 2019-05-28 华东师范大学 A kind of software configuration complexity biodegrading process, equipment and storage medium
CN109814921B (en) * 2019-01-24 2020-10-02 华东师范大学 Software structure complexity degradation method, equipment and storage medium
CN109815153A (en) * 2019-02-19 2019-05-28 北京天诚同创电气有限公司 The static slicing method and apparatus of PLC program and motor start-up and shut-down control program
CN109815153B (en) * 2019-02-19 2024-01-26 北京天诚同创电气有限公司 Static slicing method and device for PLC program and motor start-stop control program
CN109976802A (en) * 2019-03-31 2019-07-05 东南大学 A kind of software architecture reconstructing method of schema object
CN109976802B (en) * 2019-03-31 2022-08-12 东南大学 Mode-oriented software architecture reconstruction method

Similar Documents

Publication Publication Date Title
CN107450972B (en) Scheduling method and device and electronic equipment
US11422776B2 (en) Intelligent assistant for automating recommendations for analytics programs
CN105701008B (en) System and method for test case generation
CN109697500B (en) Data processing method and device, electronic equipment and storage medium
US9098630B2 (en) Data selection
CN110096263A (en) Web front end code automatic generation method and device
CN112199086A (en) Automatic programming control system, method, device, electronic device and storage medium
CN112070416B (en) AI-based RPA flow generation method, apparatus, device and medium
EP3846034B1 (en) Systems and methods for automated testing using artificial intelligence techniques
US20140052433A1 (en) Automatically extracting a model for the behavior of a mobile application
CN103853554A (en) Software reconstruction position determination method and software reconstruction position identification device
EP3509019A1 (en) Software product development defect and issue prediction and diagnosis
EP3531285A2 (en) Ace: assurance, composed and explained
US10025558B2 (en) Module division assistance device, module division assistance method, and module division assistance program
CN110928761B (en) Demand chain and system and method for application thereof
da Silva et al. On-the-fly verification of discrete event simulations by means of simulation purposes.
US20160147816A1 (en) Sample selection using hybrid clustering and exposure optimization
Hartsell et al. Workflow automation for cyber physical system development processes
CN104050083A (en) Condition/Decision-coverage-oriented test data automatic generation method
CN114120096A (en) Traffic light marking method and system based on interactive AI
CN106682064A (en) Number picking device and method for enterprise report
CN110309047B (en) Test point generation method, device and system
US9338294B2 (en) Automated task definitions
US9477927B2 (en) Automatic test generation for decision table based rules
CN112632293A (en) Industry map construction method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20140611

RJ01 Rejection of invention patent application after publication