Information processing device, information processing method, and program
The information processing device enhances system renewal by detecting similar software assets through data type and inheritance relationship analysis, enabling efficient refactoring and reducing costs.
Patent Information
- Application Number
- JP2020131812
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2020-08-03
- Publication Date
- 2024-10-02
- Estimated Expiration
- 2040-08-03
AI Technical Summary
Existing methods for detecting similar software assets during system renewal fail to account for inheritance relationships, leading to missed opportunities for generalization and refactoring.
An information processing device and method that calculates similarity between software assets by considering data type matches and inheritance relationships, using a similarity calculation unit to determine matching data types and inheritance relationships between components.
Enables detection of similar software assets suitable for generalization, facilitating efficient refactoring and reducing the time and cost of system renewal by identifying candidates for reuse.
Smart Images

Figure 0007559409000001 
Figure 0007559409000002 
Figure 0007559409000003
Abstract
Description
[Technical field]
[0001] The present invention relates to an information processing device, an information processing method, and a program. [Background technology]
[0002] There are an increasing number of cases where IT systems need to be modified or rebuilt (hereinafter referred to as "system renewal") after a certain period of time has passed since their introduction due to factors such as aging hardware, evolution of IT technology / IT infrastructure, and the end of vendor support for the software licenses being used.
[0003] In some cases, when renewing a system, the existing system is abolished and a new one is built, but the problem is that building a new system takes time and money, and if building a new system does not bring much new added value or benefit to the business, it is necessary to reuse and re-use the existing system as much as possible to reduce time and costs and minimize the impact on business management. In other words, in order to make the existing system compatible with the latest hardware, programming languages, and IT technology / IT infrastructure, the program's business processing logic and algorithms are maintained while migrating to new technology or being modified.
[0004] In such cases, it is necessary to accurately grasp the software assets of the existing system and determine which software assets to migrate, but systems that have been maintained for many years often contain a mixture of necessary software assets and software assets that are no longer necessary. One reason for this is the common practice in actual development sites of copying and modifying the original program when making modifications. Therefore, from the perspective of asset inventory, a mechanism is required to efficiently detect software assets that are similar in function. [Prior art documents] [Patent documents]
[0005] [Patent Document 1] JP 2003-280903 A Summary of the Invention [Problem to be solved by the invention]
[0006] Patent Document 1 discloses a method for detecting similar source programs by calculating the similarity between two source programs to be compared. However, this method calculates the similarity through a strict comparison at the string level, so it may not be possible to detect software assets suitable for generalization, and opportunities for refactoring may be missed.
[0007] SUMMARY OF THE PRESENT DISCLOSURE An object of the present invention is to provide an information processing apparatus, an information processing method, and a program that solve the above-mentioned problems. [Means for solving the problem]
[0008] According to a first aspect of this embodiment, the information processing device includes an acquisition unit that acquires a plurality of comparison targets written in a programming language, and a plurality of comparison targets acquired by the acquisition unit. A comparison process is performed for each of all combinations of the components to be compared to determine whether the data types of the components to be compared match each other, and the number of data types that match is calculated based on the ratio of the number of data types that match to the number of all combinations. a similarity calculation unit that calculates a similarity between the comparison objects, Even if the components have different data types, if they have an inheritance relationship, the data types are determined to match. .
[0009] According to a second aspect of this embodiment, an information processing method includes: The computer A plurality of comparison targets written in a programming language are obtained, and the plurality of comparison targets are A comparison process is performed for all combinations of the components to be compared to determine whether or not the data types of the components to be compared match each other, and even if the components have data types that do not match between the components to be compared, if they have an inheritance relationship, it is determined that the data types match, and the number of data types that match is determined based on the ratio of the number of data type matches to the number of all combinations. The similarity between the comparison objects is calculated by the inheritance relationship between the comparison objects. Calculate Put out.
[0010] According to a third aspect of the present embodiment, a program for calculating similarities between a plurality of comparison targets, the program being written in a programming language, includes: A comparison process is executed for each combination of the components to be compared to determine whether or not the data types of the components to be compared match between the comparison targets, and even if the components have data types that do not match between the comparison targets, the data types are determined to match if they have an inheritance relationship, and a comparison process is executed for each combination of the components to determine whether or not the data types of the components to be compared match between the comparison targets ... The inheritance relationship between the comparison targets Calculate The process of outputting the signal is executed. Effect of the Invention
[0011] According to the present invention, it is possible to detect similar software assets suitable for generalization. [Brief description of the drawings]
[0012] [Figure 1] FIG. 1 illustrates an example of a configuration of an information processing apparatus according to an embodiment. [Diagram 2] This is an example of two source codes to be compared. [Diagram 3] FIG. 4 is a diagram illustrating an example of relationship information in a table format according to the embodiment. [Figure 4] 1 is a diagram illustrating an example of data type information in a table format according to an embodiment. [Diagram 5] FIG. 4 is a diagram illustrating an example of calculation parameters in a table format according to the embodiment. [Figure 6] FIG. 4 is a diagram illustrating an example of calculation parameters in a table format according to the embodiment. [Figure 7] 4 is an overall flowchart of a similarity calculation process according to the present embodiment. [Figure 8] 11 is a flowchart of a type comparison process according to an embodiment. [Figure 9] 11 is a flowchart of a method comparison process according to the present embodiment. [Figure 10] 13A and 13B are diagrams illustrating respective field similarities obtained by a comparison process using tokens and by the similarity calculation of the present embodiment. [Figure 11] 13A and 13B are diagrams illustrating respective method similarities obtained by a comparison process using tokens and by the similarity calculation of the present embodiment. [Figure 12] FIG. 13 is a diagram showing the similarity of each class obtained by a comparison process using tokens and the similarity calculation of this embodiment. [Figure 13] FIG. 13 is a diagram showing an example of refactoring using detected generalization candidates. [Figure 14] FIG. 2 is a diagram illustrating a minimum configuration of an information processing device according to the present embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0013] Hereinafter, an information processing apparatus according to an embodiment will be described with reference to the drawings.
[0014] 1 is a diagram showing an example of the configuration of an information processing device 1 according to this embodiment. As shown in FIG. 1, the information processing device 1 includes an input device 100, an output device 200, a processing device 300, and a data storage unit 400.
[0015] The input device 100 receives various input operations from a user, and outputs operation signals corresponding to the input operations to the processing device 300. That is, the input device 100 receives input of information, and outputs the received information to the processing device 300. The input device 100 is, for example, a touch panel, a hardware key such as a keyboard, or a pointing device such as a mouse.
[0016] The output device 200 outputs the calculation result (similarity) calculated by the processing device 300. The output device 200 may present the calculation result to the user, for example, by outputting the calculation result to a communication terminal owned by the user and displaying the calculation result on the screen of the communication terminal. The communication terminal owned by the user may be a personal computer or a mobile terminal. The mobile terminal may be a mobile phone, a smartphone, a PDA, a tablet, a notebook computer or a laptop computer, a wearable computer, or the like. The output device 200 may also have a display device, and may display the performance result acquired from the processing device 300 on the display device.
[0017] The processing device 300 calculates the similarity between a plurality of comparison targets written in a programming language. The comparison targets are software assets, such as source code. The source code is configured to include a plurality of components (such as fields and methods). A field is a variable that represents the characteristics of a class. In the following description, the programming language is Java (registered trademark), but it may be a programming language other than Java, and there is no particular limitation on the programming language.
[0018] Figure 2 shows an example of two source codes to be compared. These source codes describe classes, and one of the comparison targets (first comparison target) is source code describing class A, and the other comparison target (second comparison target) is source code describing class B. Note that the source codes shown in Figure 2 are written side by side for ease of explanation, but in reality, this is not the case.
[0019] ClassA is a class definition and includes multiple fields (1) through (4) and multiple methods (5) through (7). ClassB is a class definition and includes multiple fields (8) through (12) and multiple methods (13) through (15).
[0020] Each of the fields and methods is an example of a "component" of the present invention.
[0021] Here, the underlined parts of classB indicate that they are different from classA as character strings. Generally, the underlined parts of classB are judged to be "different" because they are different from classA as character strings. However, the pair of field (1) and field (12) and the pair of method (7) and method (13) contain cls01 and cls02 that inherit the class "clsOYA", and are software assets suitable for generalization. Therefore, the processing device 300 of this embodiment judges the pair of field (1) and field (12) and the pair of method (7) and method (13) as "the same (matching)", rather than as "different".
[0022] The information to be compared is held in an efficiently usable format in the data storage unit 400. The data storage unit 400 may be, for example, a storage area for storing information, and may be, for example, a storage area for information realized by software such as a file, a database, a table, or a repository, or may be, for example, hardware such as an HDD, an SSD, or a server device.
[0023] The data storage unit 400 stores relationship information, data type information, calculation parameter information, and the like relating to two comparison targets.
[0024] 3 is a diagram showing an example of relationship information in table format stored in data storage unit 400. In the following description, the table in which relationship information is stored is referred to as a "relationship link table 410."
[0025] The relationship information includes information indicating the relationship between a comparison target and a component, and information indicating the relationship between a plurality of components. For example, information on a class and the fields and methods belonging to that class, a method and information relating to that method, etc. are stored as relationship information in the relationship link table 410. Information relating to a method is, for example, information on a referenced field, another method being called, or a table in a database (DB) being accessed. In the relationship link table 410, characters or character strings included in a comparison target are associated with information on "name," "type," "target," and "relationship."
[0026] "Type" indicates the type (class, method) of what is indicated in "Name". "Relationship" indicates the relationship between "Target" and "Name". When "Type" is a class, "Relationship" is one of the following information: "Field", "Method", or "Origin of Inheritance". When "Type" is a method, "Relationship" is one of the following information: "Field Reference", "Method Call", or "DB Access". This related information includes inheritance relationship information indicating information of components having an inheritance relationship. The inheritance relationship information associates information of the inherited components and information of the origin of inheritance. In the example shown in FIG. 3, when information on the "Origin of Inheritance" is associated, it indicates that what is described in the name has been inherited from the class of "Target". In other words, the origin of inheritance is described in "Target". In the example shown in FIG. 3, cls01 and cls02, which are types of classes, have the same origin of inheritance (clsOYA), and therefore indicate that the component having cls01 and the component having cls02 are in an inheritance relationship.
[0027] 4 is a diagram showing an example of data type information in table format stored in data storage unit 400. In the following description, the table in which data type information is stored is referred to as a "data type information table 420."
[0028] The data type information stored in data type information table 420 includes information on the data types of "class," "field," "return value," and "argument." "Type" in data type information table 420 indicates the data type of a "variable," and "order" refers to the order in the source description. Also, "return value" and "argument" are the return values and arguments included in the definitions of classes, fields, and methods.
[0029] FIG. 5 is a diagram showing an example of the calculation parameter table 430 in which the calculation parameters are stored. The calculation parameters include parameter information for controlling the operation during similarity calculation. The calculation parameters include either first information (e.g., ON) indicating that the inheritance relationship is taken into consideration, or second information (e.g., OFF) indicating that the inheritance relationship is not taken into consideration. That is, for example, the processing device 300 performs similarity calculation taking the inheritance relationship into consideration when "inheritance relationship consideration" is ON, and performs similarity calculation without taking the inheritance relationship into consideration when "inheritance relationship consideration" is OFF. In addition, in the example shown in FIG. 5, the calculation parameters include information on a threshold value (e.g., 0.95) that is regarded as "matching" from the similarity calculated in the similarity calculation. The first information and the second information can be switched by the user. For example, the processing device 300 switches "inheritance relationship consideration" between ON and OFF based on an operation signal from the input device 100. This allows the user to disable the similarity calculation of the inheritance relationship.
[0030] The processing device 300 may additionally define pseudo inheritance relationships for basic types other than classes for the calculation parameters as shown in Fig. 6. For example, the processing device 300 may pseudo-define "numeric type int type is derived from long type" to allow the similarity calculation unit 340 to treat int and long as the same data type and obtain further potential generalization candidates.
[0031] The following describes the configuration of the processing device 300. The processing device 300 includes an acquisition unit 310, an information extraction unit 320, an information input unit 330, and a similarity calculation unit 340.
[0032] The acquiring unit 310 acquires a plurality of comparison targets written in a programming language. For example, the acquiring unit 310 acquires a first comparison target and a second comparison target.
[0033] The information extraction unit 320 analyzes each of the first comparison target and the second comparison target, extracts information contained therein, and generates related link information, data type information, and calculated parameter information. A general program analysis technique can be used to analyze the first comparison target and the second comparison target.
[0034] The information input unit 330 stores the related link information, data type information, and calculated parameter information in table format in the data storage unit 400. However, without being limited to this, the related link information, data type information, and calculated parameter information stored in the data storage unit 400 may be acquired from outside. In other words, the configuration for generating the related link information, data type information, and calculated parameter information is not an essential configuration of the information processing device 1.
[0035] The similarity calculation unit 340 calculates the similarity between the first comparison target and the second comparison target acquired by the acquisition unit 310. As an example, the similarity calculation unit 340 extracts information on the relationship between fields and methods and the data type based on the relationship link information and the data type information, and calculates the similarity between the first comparison target and the second comparison target taking into account the inheritance relationship.
[0036] The similarity calculation unit 340 executes a comparison process for all combinations of components to compare whether the data types of the components to be compared match between the comparison targets, and counts the number of matches as the number of matches. The similarity calculation unit 340 calculates the similarity based on the ratio of the number of matches in data types to the number of all combinations. The similarity calculation unit 340 determines that the data types match even for components that do not match between the comparison targets if they have an inheritance relationship.
[0037] The similarity calculation unit 340 compares whether the data type of the first comparison target component and the data type of the second comparison target component match based on the data type information, and counts the number of matches if the data types match. If the data types do not match, the similarity calculation unit 340 determines whether the first comparison target component and the second comparison target component have an inheritance relationship based on the inheritance relationship information, and if it determines that there is an inheritance relationship, it considers them to match and counts them as the number of matches.
[0038] The overall flow of the similarity calculation process will be described below with reference to Fig. 7. Fig. 7 is an overall flowchart of the similarity calculation process of this embodiment.
[0039] The processing device 300 searches the relationship link table 410 for asset information whose "type" is "class" and selects one pair of classes as the asset information to be subjected to the first similarity judgment (step S101). The processing device 300 judges whether or not there is an inheritance relationship between the classes that are the first similarity judgment targets (step S102). When the processing device 300 judges that there is an inheritance relationship between the classes that are the first similarity judgment targets, it returns to step S101 to avoid erroneous detection.
[0040] When the processing device 300 determines that there is no inheritance relationship between the classes that are the first similarity determination targets, it determines whether or not the first similarity determination target is a simple class represented by a POJO (Plain Old Java Object) (step S103). When the first similarity determination target is a simple class represented by a POJO, the processing device 300 returns to step S101 to avoid erroneous detection due to similarity being recognized even between unrelated classes.
[0041] If the first similarity determination target is not a simple class such as a POJO, the processing device 300 performs the process of step S104. Specifically, the processing device 300 selects a pair of fields in the class selected as the first similarity determination target from the relationship link table 410, and selects the pair of fields (hereinafter referred to as a "field pair") as the second similarity determination target (step S104).
[0042] The processing device 300 executes a type comparison process on the field pair selected as the second similarity judgment target (step S105). The type comparison process is a process for determining whether one field (hereinafter referred to as the "first field") and the other field (hereinafter referred to as the "second field") of the field pair are the same data type. Therefore, the processing device 300 determines whether the first field and the second field are the same data type based on the type comparison process (step S106), and if it is determined that they are the same, it marks the field of the pair that is the second similarity judgment target (step S107) and proceeds to the process of step S108. On the other hand, if it is determined that they are not the same in step S106, the processing device 300 proceeds to the process of step S108 without executing the process of step S107.
[0043] In step S108, the processing device 300 judges whether or not all the field pairs in the first similarity judgment target have been selected as the second similarity judgment target based on the relationship link table 410. When the processing device 300 judges that all the field pairs have been selected as the second similarity judgment target, it calculates the field similarity based on the number of fields marked in step S107 in the class of the pair selected as the first similarity judgment target (hereinafter referred to as the "number of field matches") and the total number of fields in the class (hereinafter referred to as the "total number of fields") (step S109). For example, the processing device 300 calculates the field similarity in the class of the pair selected as the first similarity judgment target (hereinafter referred to as the "field similarity") by dividing the number of field matches by the total number of fields. For example, when the number of marked field matches is 7 and the total number of fields is 9, the field similarity is 0.78.
[0044] After calculating the field similarity, the processing device 300 acquires a pair of methods in the class selected as the first similarity determination target from the relationship link table 410, and selects the pair of methods as a third similarity determination target (step S110).
[0045] The processing device 300 executes a method comparison process for the pair of methods selected as the third similarity judgment target (step S111). In the method comparison process, it is determined whether the pair of methods are the same or not. Therefore, the processing device 300 determines whether the pair of methods are the same or not based on the result of the method comparison process (step S112), and if it is determined that they are the same, it marks the method of the pair that is the third similarity judgment target (step S113) and proceeds to the process of step S114. On the other hand, if the processing device 300 determines that they are not the same in step S112, it proceeds to the process of step S114 without executing the process of step S113.
[0046] In step S114, the processing device 300 judges whether or not all pairs of methods in the first similarity judgment target have been selected as the third similarity judgment target. When the processing device 300 judges that all pairs of methods have been selected as the third similarity judgment target, the processing device 300 obtains the number of methods marked in step S113 in the class of the pair selected as the first similarity judgment target, and regards the number of methods as the number of method matches (step S115). In addition, the processing device 300 obtains the total number of methods in the class of the pair selected as the first similarity judgment target (hereinafter referred to as the "total number of methods"). In this way, the processing device 300 executes steps S111 to S113 for each combination of methods in the class.
[0047] The processing device 300 determines the class similarity (hereinafter referred to as "class similarity") of the pair selected as the first similarity determination target based on the field similarity information, i.e., the field match count, the total number of fields, and the method information, i.e., the method match count and the total number of methods (step S116). For example, the processing device 300 determines the class similarity based on the following formula (1).
[0048] (Number of field matches + number of method matches) / (Total number of fields + total number of methods)…(1)
[0049] After the process of step S116, the processing device 300 judges whether or not all class pairs have been selected as first similarity determination targets (step S117). When the processing device 300 judges that all class pairs have not been selected as first similarity determination targets, the processing device 300 returns to the process of step S101, selects one class pair not selected as the first similarity determination target as the first similarity determination target, and executes the processes from step S101 to step S116. When the processing device 300 judges that all class pairs have been selected as first similarity determination targets, the processing device 300 ends the similarity calculation process.
[0050] The flow of the type comparison process will be described below with reference to Fig. 8. Fig. 8 is a flowchart of the type comparison process of this embodiment.
[0051] The processing device 300 first judges whether the data types of the pair of fields selected as the second similarity judgment target are the same (step S201). For example, the processing device 300 reads information on the data type of the first field and the data type of the second field from type information (e.g., data type information table 420), and judges that the data types of the pair are the same if the data type of the first field and the data type of the second field match, and judges that the first field and the second field are the same (step S202).
[0052] On the other hand, if the data type of the first field and the data type of the second field do not match in step S201, the processing device 300 determines that the pair of data types are not the same, and performs processing in step S203. In step S203, the processing device 300 determines whether the type of the first field and the type of the second field are both "classes". If the type of the first field and the type of the second field are both "classes", the processing device 300 determines whether to take into account an inheritance relationship (step S205). On the other hand, if the type of the first field and the type of the second field are not both "classes", the processing device 300 determines that the first field and the second field are different from each other (step S204).
[0053] In step S205, the processing device 300 refers to the calculation parameters, and if information indicating that the inheritance relationship is to be taken into consideration is set, it determines that the inheritance relationship is to be taken into consideration, and performs the process of step S206. On the other hand, the processing device 300 refers to the calculation parameters, and if information indicating that the inheritance relationship is not to be taken into consideration is set, it determines that the inheritance relationship is not to be taken into consideration, and performs the process (determination) of step S204.
[0054] When it is determined that the inheritance relationship is to be taken into consideration, the processing device 300 determines whether or not the fields have a common base class based on the inheritance relationship information (step S206). For example, when it is determined that the inheritance relationship is to be taken into consideration, the processing device 300 determines whether or not the "name" of the first field and the "name" of the second field each have the same common base class, and if so, the first field and the second field are considered to be the same (step S202). On the other hand, if the "name" of the first field and the "name" of the second field each do not have the same common base class, the processing device 300 performs the process (determination) of step S204. In other words, when the inheritance relationship is not taken into consideration, the first field and the second field are considered to be different even if they have a common base class.
[0055] The flow of the method comparison process will be described below with reference to Fig. 9. Fig. 9 is a flowchart of the method comparison process of this embodiment.
[0056] The processing device 300 sets a first variable X1 indicating the total number and a second variable X2 indicating the number of matches to "0" (step S301). The processing device 300 adds the sum (e.g., "2") of the number of return values of one method (hereinafter referred to as the "first method") and the other method (hereinafter referred to as the "second method") of the pair of methods selected as the third similarity determination targets to the first variable X1 (step S302).
[0057] The processing device 300 performs a type comparison process on the return value based on the data type information table 420, and if the result of the type comparison process shows that the data type of the return value of the first method and the data type of the return value of the second method are the same, it adds "2" to the second variable X2 (step S303). The processing device 300 adds the sum of the arguments of the two methods, i.e., the arguments of the first method and the arguments of the second method, to the first variable X1 (step S304). The processing device 300 sequentially performs a type comparison process on the arguments, and if there is any argument whose data type of the first method and the data type of the second method match, it adds "2" to the second variable X2 (step S305).
[0058] Next, the processing device 300 adds the sum of the field reference count of the first method and the field reference count of the second method to the first variable X1 (step S306). The processing device 300 sequentially performs type comparison processing on the data types of the referenced fields, and if there is a match, adds "2" to the second variable X2 (step S307).
[0059] The processing device 300 adds the sum of the number of method calls of the first method and the number of method calls of the second method to the first variable X1 (step S308). The processing device 300 sequentially performs a method call comparison process on the method calls, and if there is an identical method among the called methods, adds "2" to the second variable X2 (step S309). The method call comparison process is a process for determining whether the called methods are the same or not.
[0060] Next, the processing device 300 adds the sum of the DB access count of the first method and the DB access count of the second method to the first variable X1 (step S310). The processing device 300 sequentially performs DB access comparison processing on the DB accesses, and if there is an identical DB table being accessed, adds "2" to the second variable X2 (step S311). The DB access comparison processing is processing for determining whether or not the accessed DB tables are the same.
[0061] The processing device 300 calculates the similarity between the methods (hereinafter, referred to as "method similarity") by performing the following equation (2) (step S312).
[0062] Method similarity = number of matches (second variable X2) / total number (first variable X1) … (2)
[0063] The processing device 300 determines whether the method similarity calculated in step S312 is equal to or greater than a threshold value for determining a match (step S313), and if the method similarity is equal to or greater than the threshold value, determines that the data type of the first method is the same as the data type of the second method (step S314).On the other hand, if the method similarity calculated in step S312 is less than the threshold value, the processing device 300 determines that the data type of the first method is different from the data type of the second method (step S315).
[0064] The effects of this embodiment will be described below. Figs. 10 to 12 are diagrams showing the results of similarity obtained by token comparison processing and the results of similarity obtained by similarity calculation of this embodiment. Fig. 10 is a diagram showing field similarity. Fig. 11 is a diagram showing method similarity. Fig. 12 is a diagram showing class similarity. As shown in Figs. 10 to 12, it can be seen that generalization candidates that could not be detected by token comparison processing can be detected. Also, Fig. 13 is a diagram showing an example of refactoring using the detected generalization candidates. As shown in Fig. 13, the processing device 300 can detect software assets suitable for generalization, and refactoring becomes possible.
[0065] As companies operate and maintain IT systems over a long period of time, they often expand and modify the systems to meet the objectives of their business activities, resulting in a complex mix of old and new software, hardware, and development technologies, making it difficult to grasp the entire software assets and making it extremely difficult to expand or modify the system. In development sites, it is common to copy a base program and rewrite parts of it to create a new program. This new program may have a different function from the base program, but it may also be a reworking (refactoring) of the same function. In systems that have been maintained for many years, it is common to see a mix of new and old assets that are similar in structure.
[0066] As a result, it is not possible to efficiently take inventory of assets to be tested or migrated when making modifications or rebuilding, which leads to problems such as a decline in estimation accuracy and an increase in migration and testing man-hours. In recent years, such problems are affecting not only traditional structured languages, but also systems developed in languages with inheritance and generalization mechanisms.
[0067] Generally, similarity is calculated using code clone detection technology, but this detection technology performs strict comparisons at the string level, so slight differences due to name changes within the program or distinctions between classes with inheritance relationships can reduce the similarity, and even if there is potential for generalization, it may be excluded from the candidates, resulting in missed opportunities for refactoring.
[0068] Therefore, the information processing device 1 of the present embodiment calculates the similarity taking into consideration the inheritance relationship between the objects to be compared, thereby making it possible to detect software assets suitable for generalization, thereby ensuring opportunities for refactoring.
[0069] An embodiment of a minimum configuration of the information processing device 1 of the embodiment will be described with reference to Fig. 14. The information processing device 1 according to the present embodiment includes an acquisition unit 310 and a similarity calculation unit 340. The acquisition unit 310 acquires a plurality of comparison targets written in a programming language. The similarity calculation unit 340 calculates the similarity between the plurality of comparison targets acquired by the acquisition unit 310. In addition, the similarity calculation unit 340 calculates the similarity taking into account the inheritance relationship between the comparison targets. This makes it possible to detect similar software assets suitable for generalization.
[0070] The similarity calculation unit 340 may exclude classes in an inheritance relationship and simple classes such as POJOs from the similarity calculation targets, so as to prevent them from being erroneously detected as candidates for generalization.
[0071] In the above embodiment, the processing device 300 may additionally define a pseudo inheritance relationship for a calculation parameter with respect to a basic type that is not a class. For example, the processing device 300 may pseudo-define "numeric type int type is derived from long type" to allow the similarity calculation unit 340 to treat int and long as the same data type and obtain further potential generalization candidates.
[0072] The information processing device 1 may be realized in whole or in part by a computer. In this case, the computer may include a processor such as a CPU or a GPU, and a computer-readable recording medium. The information processing device 1, 1A may be realized by recording a program for realizing all or in part of the functions of the information processing device 1, 1A by a computer in the computer-readable recording medium, and reading and executing the program recorded in the recording medium into the processor. Here, the "computer-readable recording medium" refers to a portable medium such as a flexible disk, an optical magnetic disk, a ROM, a CD-ROM, and a storage device such as a hard disk built into a computer system. Furthermore, the "computer-readable recording medium" may also include a medium that dynamically holds a program for a short period of time, such as a communication line when a program is transmitted via a network such as the Internet or a communication line such as a telephone line, and a medium that holds a program for a certain period of time, such as a volatile memory inside a computer system that is a server or a client in that case. The program may be a program for realizing a part of the functions described above, or may be a program that can realize the functions described above in combination with a program already recorded in the computer system, or may be a program that is realized using a programmable logic device such as an FPGA.
[0073] The above program may also be transmitted from a computer system in which the program is stored in a storage device or the like to another computer system via a transmission medium, or by transmission waves in the transmission medium. Here, the "transmission medium" that transmits the program refers to a medium that has the function of transmitting information, such as a network (communication network) such as the Internet or a communication line (communication line) such as a telephone line. The above program may also be for realizing part of the above-mentioned functions. Furthermore, it may be a so-called difference file (difference program) that can realize the above-mentioned functions in combination with a program already recorded in the computer system.
[0074] Throughout the specification, when a part is described as "comprising" or "having" a certain element, this does not mean that it excludes other elements, but that it may further include other elements, unless specifically stated to the contrary.
[0075] The term "unit" in the specification means a unit that processes at least one function or operation, which may be embodied as hardware or software, or a combination of hardware and software. [Explanation of symbols]
[0076] 1. Information processing device 300 Processing Equipment 310 Acquisition Department 320 Information extraction section 330 Information Input Section 340 Similarity calculation unit 400 Data Storage Unit
Claims
1. An acquisition unit that acquires a plurality of comparison targets written in a programming language; a similarity calculation unit that executes a comparison process for comparing whether data types of components of the plurality of comparison targets acquired by the acquisition unit match between the comparison targets for each of all combinations of the components, and calculates a similarity between the comparison targets based on a ratio of the number of data type matches to the number of all combinations; Equipped with the similarity calculation unit determines that the data types of the components to be compared are the same if the components have an inheritance relationship, even if the components have different data types. Information processing device.
2. a data storage unit for storing data type information indicating data types of the plurality of components included in each of the first comparison target and the second comparison target, which are comparison targets, and inheritance relationship information indicating information of components having the inheritance relationship among the plurality of components; the similarity calculation unit compares whether a data type of the first comparison target component and a data type of the second comparison target component match based on the data type information, and if the data types match, counts the number of matches; if the data types do not match, determines whether the first comparison target component and the second comparison target component have an inheritance relationship based on the inheritance relationship information, and if it is determined that there is an inheritance relationship, counts the number of matches. The information processing device according to claim 1 .
3. the data storage unit stores either first information indicating that the inheritance relationship is to be taken into consideration or second information indicating that the inheritance relationship is not to be taken into consideration; When the first information is stored in the data storage unit and it is determined that the inheritance relationship exists, the similarity calculation unit counts the number of matches, and when the second information is stored in the data storage unit, the similarity calculation unit does not count the number of matches even if the inheritance relationship exists. The information processing device according to claim 2 .
4. The inheritance relationship information associates information about the inherited component with information about its inheritance source, The similarity calculation unit determines that the inheritance relationship exists if the information of the inheritance source matches.
4. The information processing device according to claim 2 or 3.
5. A computer obtains a plurality of comparison objects written in a programming language, and executes a comparison process for all combinations of the components of the obtained comparison objects to determine whether the data types of the components of the comparison objects match between the comparison objects, and determines that the data types of the components that do not match between the comparison objects match if they have an inheritance relationship, and calculates the similarity between the comparison objects based on the ratio of the number of data type matches to the number of all combinations. Information processing methods.
6. a process of causing a computer that calculates the similarity of a plurality of comparison targets written in a programming language to execute a comparison process for comparing whether or not the data types of the components of the plurality of comparison targets match between the comparison targets for each combination of the components, determining that the data types match even for components that do not match between the comparison targets if they have an inheritance relationship, and calculating the inheritance relationship between the comparison targets based on the ratio of the number of data type matches to the number of all combinations; A program that executes the following.
Citation Information
Patent Citations
System for generating source program comparison information
JP2003280903A
Source code editing device, source code edit processing method and source code edit processing program
JP2004326312A
File extracting system and program
JP2005346578A
