Method and apparatus for analyzing correctness of data coupling based on source code of software architecture
Patent Information
- Application Number
- CN202210850896.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-19
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2042-07-19
AI Technical Summary
不过,在很多软件架构设计文档及其模板中,通常只有软件功能部件的划分,却没有以显式的形式定义完整的数据流和控制流,很难直接依据软件架构设计文档评审软件部件之间数据流与控制流的正确性
[0058] Compared with existing technologies, this invention has the following advantages: It utilizes source code data coupling analysis results to reverse-engineer software architecture data coupling analysis, and simultaneously evaluates the correctness of software source code data coupling based on the software architecture. Specifically, firstly, based on the software architecture's division of functional components and the function call relationships within those components, the inclusion relationships between software components and functions are clarified; then, using the intermediate results generated during the analysis of source code data coupling correctness, corresponding component information is supplemented, and the relationships are equivalently converted into component data coupling relationships; finally, the consistency between the component data coupling relationships generated by reverse engineering the source code and the component input/output interfaces defined in the software architecture, as well as the data flow and control flow between components, is reviewed to complete the correctness analysis of source code data coupling based on the software architecture.
Smart Images

Figure CN117453516B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software testing and verification, and specifically to a method and apparatus for analyzing the correctness of source code data coupling based on software architecture. Background Technology
[0002] DO-178B / C, "Software Considerations in the Conformity Assessment of Airborne Systems and Equipment," sets forth the verification objective of "achieving test coverage of the software architecture (data coupling and control coupling)." This aims to ensure the correctness of interactions and dependencies between modules / components. Since software functional components are defined during the software architecture design process, only by conducting data coupling and control coupling analysis on the software architecture can it be proven that software modules / components interact in the manner defined by the developers, avoiding unplanned, abnormal, or erroneous behavior. Therefore, data coupling coverage analysis based on the software architecture is a crucial component of software architecture review and analysis.
[0003] Based on the aforementioned needs, a software data coupling coverage analysis method and apparatus were developed. This is a software data coupling analysis scheme that approximates data from both ends of the software development lifecycle (high-level requirements, source code) towards the middle (low-level requirements, software architecture) in a bidirectional approach, combining forward and reverse methods. To fully implement this scheme in airborne software verification practice, it is necessary to further decompose each data coupling analysis sub-process.
[0004] According to DO-178C, software architecture is the software structure selected to achieve software requirements, and is usually presented in documented form. As required by DO-178C, source code should conform to the software architecture; that is, the source code should match the data flow and control flow defined in the software architecture. As the representation of the interface between software components, the definitions of control flow and data flow should be consistent across components.
[0005] To assess the consistency of data flow and control flow relationships between software components based on textual software architecture, it is necessary to define complete data flow and control flow in the software architecture using data flow diagrams, control flow diagrams, or other equivalent forms, and then conduct review activities based on this. However, many software architecture design documents and their templates typically only define the division of software functional components without explicitly defining complete data flow and control flow, making it difficult to directly review the correctness of data flow and control flow between software components based on the software architecture design document. Summary of the Invention
[0006] The following provides a brief overview of one or more aspects to offer a basic understanding of them. This overview is not an exhaustive summary of all conceived aspects, nor is it intended to identify key or decisive elements of all aspects, nor to define the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form to prepare for the more detailed descriptions that follow.
[0007] The purpose of this invention is to solve the above-mentioned problems. It proposes a method and apparatus for analyzing the correctness of source code data coupling based on software architecture. On the one hand, it is used to evaluate the consistency of data coupling between functional components defined in the software architecture. On the other hand, it provides a solution for evaluating the correctness of source code data coupling relationships based on software architecture, thereby improving the efficiency of software architecture data coupling analysis.
[0008] The technical solution of this invention is as follows: This invention discloses a method for analyzing the correctness of source code data coupling based on software architecture, the method comprising:
[0009] Step 1: Extract the inclusion relationships between software components and functions;
[0010] Step 2: Convert the source code data coupling analysis results into preliminary software component data coupling analysis results;
[0011] Step 3: Check the source code for redundant function modules that have not been assigned to software components;
[0012] Step 4: Check if the corresponding functional components are not implemented in the software source code;
[0013] Step 5: Extract effective definition-use pairs for software component variables;
[0014] Step 6: Filter out redundant data within software components from the preliminary analysis results of software component data coupling;
[0015] Step 7: Reintegrate the data coupling analysis results of software components;
[0016] Step 8: Review whether the data coupling relationships of software components conform to the software architecture document.
[0017] According to an embodiment of the source code data coupling correctness analysis method based on software architecture of the present invention, step 1 further includes:
[0018] Based on the division of top-level components in the software architecture, and combined with the function call relationships within the software components, the inclusion relationships between software components and functions are sorted out to form a software component function composition information table.
[0019] According to an embodiment of the source code data coupling correctness analysis method based on software architecture of the present invention, step 2 further includes:
[0020] Based on the source code data coupling analysis results, add a "Component Name" column before the "Function Name" column in the function input / output variable table, function variable "Definition" table, and function variable "Use" table, equivalent to converting them into component input / output variable draft tables, component variable "Definition" draft tables, and component variable "Use" draft tables. Add a "Component Name" column to the definition and use columns of the valid function variable "Definition-Use" pair table, equivalent to converting them into a component variable "Definition-Use" pair draft table. Add three "Component Name" columns before the function names in the source code module data coupling relationship table, equivalent to converting them into a component data coupling relationship draft table. Based on the software component function composition information table, fill the newly added columns in the component input / output variable draft table, component variable "Definition" draft table, component variable "Use" draft table, component variable "Definition-Use" pair draft table, and component data coupling relationship draft table with the component names corresponding to the function names.
[0021] According to an embodiment of the source code data coupling correctness analysis method based on software architecture of the present invention, step 3 further includes:
[0022] Filter the component input and output variable drafts, component variable "definition" drafts, component variable "use" drafts, and component variable "definition-use" drafts. Check if there is NA information in the "Component Name" column of the component variable "definition-use" drafts. If so, there are redundant function modules that have not been assigned to the software component, or necessary software component definitions are missing. A defect report should be submitted. Otherwise, continue the analysis.
[0023] According to an embodiment of the source code data coupling correctness analysis method based on software architecture of the present invention, step 4 further includes:
[0024] Continue reviewing whether each component defined in the software component function composition information table can be found in the corresponding data items in each draft table; if not, the corresponding functional components may have been omitted when the software component was implemented as source code, and the inconsistencies need to be recorded, a defect report submitted, and the software designer to supplement the implementation of the corresponding components or revise the textual errors in the architecture document; if yes, continue the analysis.
[0025] According to an embodiment of the source code data coupling correctness analysis method based on software architecture of the present invention, step 5 further includes:
[0026] Remove the "Define-Use" pairs between functions within a component from the component variable "Define-Use" draft table. That is, remove the "Define-Use" pairs of variables with the same "Component Name" in the "Define" and "Use" columns. Only keep the "Define-Use" pairs between components to form a valid software component variable "Define-Use" pair table.
[0027] According to an embodiment of the source code data coupling correctness analysis method based on software architecture of the present invention, step 6 further includes:
[0028] Based on the valid software component variable "definition-use" pair table, delete the data definition and / or use entries that do not exist in the valid software component variable "definition-use" pair table from the component input and output variable draft table, component variable "definition" draft table, component variable "use" draft table, and component data coupling relationship draft table, respectively, to generate the component input and output variable table, component variable "definition" table, component variable "use" table, and component data coupling relationship draft table.
[0029] According to an embodiment of the source code data coupling correctness analysis method based on software architecture of the present invention, step 7 further includes:
[0030] Optimize the arrangement of table content by taking software components as the object: According to the principle of the same "component name", the data with the same component name in the component data coupling relationship draft table are arranged in a centralized manner to obtain the complete input and output interfaces of each component, complete the data coupling relationship analysis between related components, and form a software component data coupling relationship table.
[0031] According to an embodiment of the source code data coupling correctness analysis method based on software architecture of the present invention, step 8 further includes:
[0032] Based on the software architecture document, review the consistency of information in the component input / output variable tables, component variable "definition" tables, component variable "usage" tables, and component data coupling relationship tables with the component input / output interface definitions defined in the software architecture, and whether the data flow and control flow between components are consistent. Determine whether the data coupling relationships between the software source code and the components are consistent, and whether the data coupling relationships implemented in the software source code are correct. If there are inconsistencies, record the inconsistencies and submit a defect report; otherwise, determine that the software source code implements the component data coupling relationships correctly, and end the analysis.
[0033] This invention also discloses a source code data coupling correctness analysis device based on software architecture, the device comprising:
[0034] The inclusion relationship extraction module is used to extract the inclusion relationships between software components and functions;
[0035] The coupling analysis result conversion module is used to convert the source code data coupling analysis results into preliminary software component data coupling analysis results;
[0036] The unassigned redundant function check module is used to check whether there are redundant function modules in the source code that have not been assigned to software components.
[0037] The Unimplemented Functional Components Check Module is used to check whether the corresponding functional components are not implemented in the software source code.
[0038] The extraction module is used to extract valid definition-use pairs for software component variables;
[0039] The filtering module is used to filter out redundant data within software components in the preliminary analysis results of data coupling of software components.
[0040] The integration module is used to reintegrate the data coupling analysis results of software components;
[0041] The coupling compliance assessment module is used to review whether the data coupling relationships of software components comply with the software architecture document.
[0042] According to an embodiment of the source code data coupling correctness analysis apparatus based on software architecture of the present invention, the relationship extraction module is further configured as follows:
[0043] Based on the division of top-level components in the software architecture, and combined with the function call relationships within the software components, the inclusion relationships between software components and functions are sorted out to form a software component function composition information table.
[0044] According to an embodiment of the source code data coupling correctness analysis apparatus based on software architecture of the present invention, the coupling analysis result conversion module is further configured as follows:
[0045] Based on the source code data coupling analysis results, add a "Component Name" column before the "Function Name" column in the function input / output variable table, function variable "Definition" table, and function variable "Use" table, equivalent to converting them into component input / output variable draft tables, component variable "Definition" draft tables, and component variable "Use" draft tables. Add a "Component Name" column to the definition and use columns of the valid function variable "Definition-Use" pair table, equivalent to converting them into a component variable "Definition-Use" pair draft table. Add three "Component Name" columns before the function names in the source code module data coupling relationship table, equivalent to converting them into a component data coupling relationship draft table. Based on the software component function composition information table, fill the newly added columns in the component input / output variable draft table, component variable "Definition" draft table, component variable "Use" draft table, component variable "Definition-Use" pair draft table, and component data coupling relationship draft table with the component names corresponding to the function names.
[0046] According to an embodiment of the source code data coupling correctness analysis apparatus based on software architecture of the present invention, the unallocated redundancy function checking module is further configured as follows:
[0047] Filter the component input and output variable drafts, component variable "definition" drafts, component variable "use" drafts, and component variable "definition-use" drafts. Check if there is NA information in the "Component Name" column of the component variable "definition-use" drafts. If so, there are redundant function modules that have not been assigned to the software component, or necessary software component definitions are missing. A defect report should be submitted. Otherwise, continue the analysis.
[0048] According to an embodiment of the source code data coupling correctness analysis apparatus based on software architecture of the present invention, the unimplemented functional component checking module is further configured as follows:
[0049] Continue reviewing whether each component defined in the software component function composition information table can be found in the corresponding data items in each draft table; if not, the corresponding functional components may have been omitted when the software component was implemented as source code, and the inconsistencies need to be recorded, a defect report submitted, and the software designer to supplement the implementation of the corresponding components or revise the textual errors in the architecture document; if yes, continue the analysis.
[0050] According to an embodiment of the source code data coupling correctness analysis apparatus based on software architecture of the present invention, the extraction module is further configured as follows:
[0051] Remove the "Define-Use" pairs between functions within a component from the component variable "Define-Use" draft table. That is, remove the "Define-Use" pairs of variables with the same "Component Name" in the "Define" and "Use" columns. Only keep the "Define-Use" pairs between components to form a valid software component variable "Define-Use" pair table.
[0052] According to an embodiment of the source code data coupling correctness analysis apparatus based on software architecture of the present invention, the filtering module is further configured as follows:
[0053] Based on the valid software component variable "definition-use" pair table, delete the data definition and / or use entries that do not exist in the valid software component variable "definition-use" pair table from the component input and output variable draft table, component variable "definition" draft table, component variable "use" draft table, and component data coupling relationship draft table, respectively, to generate the component input and output variable table, component variable "definition" table, component variable "use" table, and component data coupling relationship draft table.
[0054] According to an embodiment of the source code data coupling correctness analysis apparatus based on software architecture of the present invention, the integration module is further configured as follows:
[0055] Optimize the arrangement of table content by taking software components as the object: According to the principle of the same "component name", the data with the same component name in the component data coupling relationship draft table are arranged in a centralized manner to obtain the complete input and output interfaces of each component, complete the data coupling relationship analysis between related components, and form a software component data coupling relationship table.
[0056] According to an embodiment of the source code data coupling correctness analysis apparatus based on software architecture of the present invention, the coupling relationship compliance determination module is further configured as follows:
[0057] Based on the software architecture document, review the consistency of information in the component input / output variable tables, component variable "definition" tables, component variable "usage" tables, and component data coupling relationship tables with the component input / output interface definitions defined in the software architecture, and whether the data flow and control flow between components are consistent. Determine whether the data coupling relationships between the software source code and the components are consistent, and whether the data coupling relationships implemented in the software source code are correct. If there are inconsistencies, record the inconsistencies and submit a defect report; otherwise, determine that the software source code implements the component data coupling relationships correctly, and end the analysis.
[0058] Compared with existing technologies, this invention has the following advantages: It utilizes source code data coupling analysis results to reverse-engineer software architecture data coupling analysis, and simultaneously evaluates the correctness of software source code data coupling based on the software architecture. Specifically, firstly, based on the software architecture's division of functional components and the function call relationships within those components, the inclusion relationships between software components and functions are clarified; then, using the intermediate results generated during the analysis of source code data coupling correctness, corresponding component information is supplemented, and the relationships are equivalently converted into component data coupling relationships; finally, the consistency between the component data coupling relationships generated by reverse engineering the source code and the component input / output interfaces defined in the software architecture, as well as the data flow and control flow between components, is reviewed to complete the correctness analysis of source code data coupling based on the software architecture.
[0059] Compared to existing technologies, the present invention is characterized by fully utilizing the correspondence between software components and functions. Based on the automatic analysis results of source code data coupling, it reverse-engineers data coupling analysis results based on the software architecture, thereby minimizing the workload of analysis. This invention overcomes the limitations of existing solutions that rely solely on the division of functional components within the software architecture for data coupling analysis, and whose analysis workload depends on the standardization of software architecture data flow and control flow definitions.
[0060] Using the software data coupling analysis process of this invention, the automatic analysis results of source code data coupling can be fully utilized. Based on the analysis of the correspondence between software components and functions, data coupling analysis results based on the software architecture can be generated in reverse. This minimizes the workload of data coupling analysis between software functional components and improves the efficiency of data coupling relationship analysis in the software architecture. At the same time, during the analysis process, it is possible to determine whether the data coupling relationship between the software source code and the software architecture is consistent, and to evaluate whether the data flow between source code functions is correct based on the software architecture. Attached Figure Description
[0061] The above-described features and advantages of the present invention will be better understood after reading the following detailed description of embodiments of the present disclosure in conjunction with the accompanying drawings. In the drawings, components are not necessarily drawn to scale, and components having similar related characteristics or features may have the same or similar reference numerals.
[0062] Figure 1 A flowchart of an embodiment of the source code data coupling correctness analysis method based on software architecture of the present invention is shown.
[0063] Figure 2 A schematic diagram of an embodiment of the source code data coupling correctness analysis device based on software architecture of the present invention is shown. Detailed Implementation
[0064] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. It should be noted that the aspects described below with reference to the accompanying drawings and specific embodiments are merely exemplary and should not be construed as limiting the scope of protection of the present invention in any way.
[0065] To conduct source code data coupling correctness analysis based on software architecture, the first step is to analyze the inclusion relationships between software components and functions based on the top-level component divisions and the function call relationships within those components. Next, the source code data coupling analysis results are converted into preliminary software component data coupling analysis results. This involves checking for redundant function modules not assigned to software components and for any missing functional components. Then, valid "definition-usage" pairs for software component variables are extracted, and redundant data within components is filtered out from the preliminary analysis results. Finally, the software component data coupling analysis results are reviewed to ensure they conform to the software architecture documentation.
[0066] Because the source code data coupling correctness analysis requires the results of source code data coupling analysis, it is necessary to complete the source code-based data coupling analysis first before conducting the source code data coupling correctness analysis based on the software architecture.
[0067] Figure 1 The flowchart of an embodiment of the source code data coupling correctness analysis method based on software architecture of the present invention is shown.
[0068] Step 1: Extract the inclusion relationships between software components and functions.
[0069] Based on the division of top-level components in the software architecture and the function call relationships within the software components, the inclusion relationships between software components and functions are sorted out, forming Software Component Function Composition Information Table 4-0.
[0070] Table 1 Software Component Function Composition Information Table 4-0
[0071]
[0072] Step 2: Convert the source code data coupling analysis results into preliminary software component data coupling analysis results.
[0073] Based on the source code data coupling analysis results, add a "Component Name" column before the "Function Name" column in Table 2-1 (function input / output variables), Table 2-2 (function variable "definition"), and Table 2-3 (function variable "use" - i.e., reference). This is equivalent to converting them into Draft Table 4-1-0 (component input / output variables), Draft Table 4-2-0 (component variable "definition"), and Draft Table 4-3-0 (component variable "use"). For valid function variables, add a "Component Name" column to both the "Definition" and "Use (Reference)" columns in Table 2-4. The "Component Name" column is equivalent to the component variable "Definition-Use" in Draft Table 4-4-0. Add three columns "Component Name" before the function names (including input source and output destination) in the source code module data coupling relationship table 2-5, which is equivalent to the component data coupling relationship draft table 4-5-0. Based on the software component function composition information table 4-0, fill the newly added columns in tables 4-1-0, 4-2-0, 4-3-0, 4-4-0, and 4-5-0 with the component names corresponding to the function names (if they do not exist, fill in NA).
[0074] Table 2 Draft of Component Input and Output Variables 4-1-0 / Table 4-1 of Component Input and Output Variables
[0075]
[0076] Table 3 Draft Table 4-2-0 of Component Variable "Definition" / Table 4-2 of Component Variable "Definition"
[0077]
[0078] Table 4 Component Variable "Use" Draft 4-3-0 / Component Variable "Use" Table 4-3
[0079]
[0080] Table 5 shows the "Definition-Use" of component variables for Draft 4-4-0 / the "Definition-Use" of valid component variables for Table 4-4.
[0081]
[0082] Table 6 Draft Table 4-5-0 of Component Data Coupling Relationships / Draft Table 4-5-1 of Component Data Coupling Relationships / Table 4-5 of Component Data Coupling Relationships
[0083]
[0084] Function input and output variable table 2-1
[0085]
[0086] Function variable "definition" Table 2-2
[0087]
[0088] Function Variable "Use" Table 2-3
[0089]
[0090] Table 2-4 shows the valid definition-use pairs between function variables.
[0091]
[0092] Source code module data coupling relationship table 2-5
[0093]
[0094] Step 3: Check the source code for redundant function modules that have not been assigned to software components.
[0095] Filter the component input and output variables (draft 4-1-0), component variable "definition" (draft 4-2-0), component variable "use" (draft 4-3-0), and component variable "definition-use" (draft 4-4-0). Does the "Component Name" column in draft 4-4-0 contain NA information? If so, there are redundant function modules that have not been assigned to the software component, or necessary software component definitions are missing, and a defect report should be submitted. Otherwise, continue the analysis.
[0096] Step 4: Check if the corresponding functional components are not implemented in the software source code.
[0097] Continue reviewing whether each component defined in Software Component Function Composition Information Table 4-0 can be found in its corresponding data item in each draft table. If not, the corresponding functional component may have been omitted when the software component was implemented as source code. Inconsistencies need to be recorded, a defect report submitted, and the software designer should supplement the implementation of the corresponding component or revise the textual errors in the architecture document; otherwise, continue the analysis.
[0098] Step 5: Extract effective definition-use pairs for software component variables.
[0099] Remove the "Define-Use" pairs between functions within a component (internal interface of the component) from the component variable "Define-Use" draft table 4-4-0. That is, remove the "Define-Use" (DU) pairs of variables with the same "Component Name" in the "Define" and "Use" columns. Only retain the "Define-Use" pairs between components (external interface of the component) to form a valid software component variable "Define-Use" pair table 4-4.
[0100] Step 6: Filter out redundant data within the components in the preliminary analysis results of software component data coupling.
[0101] Based on the valid software component variable "definition-use" pair in Table 4-4, delete the data definition and / or use entries that do not exist in Table 4-4 from the component input and output variable draft tables 4-1-0, component variable "definition" draft tables 4-2-0, component variable "use" draft tables 4-3-0, and component data coupling relationship draft tables 4-5-0, respectively, to generate component input and output variable table 4-1, component variable "definition" table 4-2, component variable "use" table 4-3, and component data coupling relationship draft table 4-5-1.
[0102] Step 7: Reintegrate the data coupling analysis results of software components.
[0103] Taking software components as the object, optimize the arrangement of table content: according to the principle of the same "component name", centrally arrange the data with the same component name in the draft table 4-5-1 of component data coupling relationship, obtain the complete input and output interface of each component, complete the data coupling relationship analysis between related components, and form the software component data coupling relationship table 4-5.
[0104] Step 8: Review whether the data coupling relationships of software components conform to the software architecture document.
[0105] Based on the software architecture document, review the information in Table 4-1 (component input / output variable), Table 4-2 (component variable "definition"), Table 4-3 (component variable "usage"), and Table 4-5 (component data coupling relationship) for consistency with the component input / output interface definitions defined in the software architecture, and verify the consistency of data flow and control flow between components. Determine whether the data coupling relationships between the software source code and the components are consistent, and whether the data coupling relationships implemented in the software source code are correct. If there are inconsistencies, record the inconsistencies and submit a defect report; otherwise, determine that the software source code correctly implements the component data coupling relationships, and end the analysis.
[0106] Figure 2 This illustrates the principle of an embodiment of the source code data coupling correctness analysis apparatus based on software architecture of the present invention. In the following description, the tables and above-mentioned... Figure 1 The specific contents of the table are the same as in the previous example and will not be repeated here. Please refer to [link / reference]. Figure 2 The device in this embodiment includes the following modules connected in sequence: a relationship extraction module, a coupling analysis result conversion module, an unallocated redundant function checking module, an unimplemented functional component checking module, a refining module, a filtering module, an integration module, and a coupling relationship compliance determination module.
[0107] The inclusion relationship extraction module is used to extract the inclusion relationships between software components and functions.
[0108] The inclusion relationship extraction module is further configured as follows: based on the division of top-level components in the software architecture and combined with the function call relationships within the software components, the inclusion relationships between software components and functions are sorted out to form a software component function composition information table.
[0109] The coupling analysis result conversion module is used to convert the source code data coupling analysis results into preliminary software component data coupling analysis results.
[0110] The coupling analysis result conversion module is further configured as follows: Utilizing the source code data coupling analysis results, a "Component Name" column is added before the "Function Name" column in each of the function input / output variable tables, function variable "Definition" tables, and function variable "Usage" tables, equivalent to converting them into component input / output variable draft tables, component variable "Definition" draft tables, and component variable "Usage" draft tables; a "Component Name" column is added to the definition and usage columns in the valid function variable "Definition-Usage" pair table, equivalent to converting them into a component variable "Definition-Usage" pair draft table; three "Component Name" columns are added before the function names in the source code module data coupling relationship table, equivalent to converting them into a component data coupling relationship draft table; based on the software component function composition information table, the newly added columns in the component input / output variable draft table, component variable "Definition" draft table, component variable "Usage" draft table, component variable "Definition-Usage" pair draft table, and component data coupling relationship draft table are respectively filled with the component names corresponding to the function names.
[0111] The Unassigned Redundancy Function Check Module is used to check whether there are redundant function modules in the source code that have not been assigned to software components.
[0112] The unassigned redundant function check module is further configured as follows: filter the component input and output variable drafts, component variable "definition" drafts, component variable "use" drafts, and whether there is NA information in the "Component Name" column of the component variable "definition-use" pair drafts. If so, there is a redundant function module that has not been assigned to the software component, or a necessary software component definition is missing, and a defect report should be submitted; otherwise, continue the analysis.
[0113] The Unimplemented Functional Components Check module is used to check whether the corresponding functional components are not implemented in the software source code.
[0114] The unimplemented functional component inspection module is further configured as follows: continue to review whether each component defined in the software component function composition information table can be found in each draft table; if not, the corresponding functional component may have been omitted when the software component was implemented as source code, and the inconsistency needs to be recorded, a defect report submitted, and the software designer to supplement the implementation of the corresponding component or revise the textual errors in the architecture document; if yes, continue the analysis.
[0115] The refinement module is used to refine valid definition-use pairs of software component variables.
[0116] The extraction module is further configured as follows: delete the "definition-use" pairs between functions within a component from the component variable "definition-use" draft table, that is, the "definition-use" pairs of variables with the same "component name" in the definition and use columns, and only retain the "definition-use" pairs between components to form a valid software component variable "definition-use" pair table.
[0117] The filtering module is used to filter out redundant data within software components in the preliminary analysis results of data coupling of software components.
[0118] The filtering module is further configured to: based on the valid software component variable "definition-use" pair table, delete entries of data definitions and / or uses that do not exist in the valid software component variable "definition-use" pair table from the component input and output variable draft tables, the component variable "definition" draft table, the component variable "use" draft table, and the component data coupling relationship draft table, respectively, and generate the component input and output variable table, the component variable "definition" table, the component variable "use" table, and the component data coupling relationship draft table.
[0119] The integration module is used to reintegrate the data coupling analysis results of software components.
[0120] The integration module is further configured as follows: taking software components as objects, optimize the arrangement of table content: according to the principle of the same "component name", the data with the same component name in the component data coupling relationship draft table are arranged in a centralized manner to obtain the complete input and output interfaces of each component, complete the data coupling relationship analysis between related components, and form a software component data coupling relationship table.
[0121] The coupling compliance assessment module is used to review whether the data coupling relationships of software components comply with the software architecture document.
[0122] The coupling compliance determination module is further configured as follows: Based on the software architecture document, it sequentially reviews the consistency of information in the component input and output variable tables, component variable "definition" tables, component variable "usage" tables, and component data coupling relationship tables with the component input and output interface definitions defined in the software architecture, and whether the data flow and control flow between components are consistent; it determines whether the data coupling relationship between the software source code and the components is consistent, and whether the component data coupling relationship implemented in the software source code is correct; if they are inconsistent, the inconsistency is recorded and a defect report is submitted; otherwise, the software source code is determined to have correctly implemented the component data coupling relationship, and the analysis ends.
[0123] Although the methods described above are illustrated and depicted as a series of actions for the sake of simplicity, it should be understood and appreciated that these methods are not limited by the order of the actions, as some actions may occur in a different order and / or concurrently with other actions from the illustrations and descriptions herein or not illustrated and described herein but which may be understood by those skilled in the art, according to one or more embodiments.
[0124] Those skilled in the art will further appreciate that the various illustrative logic blocks, modules, circuits, and algorithm steps described in conjunction with the embodiments disclosed herein can be implemented as electronic hardware, computer software, or a combination of both. To clearly illustrate this interchangeability between hardware and software, the various illustrative components, blocks, modules, circuits, and steps are described above in a generalized manner in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the specific application and the design constraints imposed on the overall system. Those skilled in the art may implement the described functionality in different ways for each specific application, but such implementation decisions should not be construed as departing from the scope of the invention.
[0125] The various illustrative logic blocks, modules, and circuits described in conjunction with the embodiments disclosed herein can be implemented or performed using a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. The general-purpose processor may be a microprocessor, but in alternatives, it may be any conventional processor, controller, microcontroller, or state machine. The processor may also be implemented as a combination of computing devices, such as a combination of a DSP and a microprocessor, multiple microprocessors, one or more microprocessors cooperating with a DSP core, or any other such configuration.
[0126] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of both. The software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor such that the processor can read and write information to / from the storage medium. In an alternative, the storage medium may be integrated into the processor. The processor and storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In an alternative, the processor and storage medium may reside as discrete components in the user terminal.
[0127] In one or more exemplary embodiments, the described functionality may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software as a computer program product, the functionality may be stored or transmitted as one or more instructions or code on or through a computer-readable medium. A computer-readable medium includes both computer storage media and communication media, encompassing any medium that facilitates the transfer of a computer program from one location to another. A storage medium may be any available medium accessible to a computer. By way of example and not limitation, such a computer-readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disc storage, disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and is accessible to a computer. Any connection is also legitimately referred to as a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of a medium. As used in this article, disk and disc include compact discs (CDs), laser discs, optical discs, digital multi-purpose discs (DVDs), floppy disks, and Blu-ray discs. Disks typically reproduce data magnetically, while discs reproduce data optically using lasers. Combinations of these should also be included within the scope of computer-readable media.
[0128] The prior description of this disclosure is provided to enable any person skilled in the art to make or use this disclosure. Various modifications to this disclosure will be apparent to those skilled in the art, and the general principles defined herein may be applied to other variations without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not intended to be limited to the examples and designs described herein, but should be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for analyzing the correctness of source code data coupling based on software architecture, characterized in that, The methods include: Step 1: Extract the inclusion relationships between software components and functions; Step 2: Convert the source code data coupling analysis results into preliminary software component data coupling analysis results; Step 3: Check the source code for redundant function modules that have not been assigned to software components; Step 4: Check if the corresponding functional components are not implemented in the software source code; Step 5: Extract effective definition-use pairs for software component variables; Step 6: Filter out redundant data within software components from the preliminary analysis results of software component data coupling; Step 7: Reintegrate the data coupling analysis results of software components; Step 8: Review whether the data coupling relationships of software components conform to the software architecture document; Step 2 further includes: Based on the source code data coupling analysis results, add a "Component Name" column before the "Function Name" column in the function input / output variable table, function variable "Definition" table, and function variable "Use" table, equivalent to converting them into component input / output variable draft tables, component variable "Definition" draft tables, and component variable "Use" draft tables. Add a "Component Name" column to the definition and use columns of the valid function variable "Definition-Use" pair table, equivalent to converting them into a component variable "Definition-Use" pair draft table. Add three "Component Name" columns before the function names in the source code module data coupling relationship table, equivalent to converting them into a component data coupling relationship draft table. Based on the software component function composition information table, fill the newly added columns in the component input / output variable draft table, component variable "Definition" draft table, component variable "Use" draft table, component variable "Definition-Use" pair draft table, and component data coupling relationship draft table with the component names corresponding to the function names.
2. The source code data coupling correctness analysis method based on software architecture according to claim 1, characterized in that, Step 1 further includes: Based on the division of top-level components in the software architecture, and combined with the function call relationships within the software components, the inclusion relationships between software components and functions are sorted out to form a software component function composition information table.
3. The source code data coupling correctness analysis method based on software architecture according to claim 1, characterized in that, Step 3 further includes: Filter the component input and output variable drafts, component variable "definition" drafts, component variable "use" drafts, and component variable "definition-use" drafts. Check if there is NA information in the "Component Name" column of the component variable "definition-use" drafts. If so, there are redundant function modules that have not been assigned to the software component, or necessary software component definitions are missing. A defect report should be submitted. Otherwise, continue the analysis.
4. The source code data coupling correctness analysis method based on software architecture according to claim 1, characterized in that, Step 4 further includes: Continue reviewing whether each component defined in the software component function composition information table can be found in the corresponding data items in each draft table; if not, the corresponding functional components may have been omitted when the software component was implemented as source code, and the inconsistencies need to be recorded, a defect report submitted, and the software designer to supplement the implementation of the corresponding components or revise the textual errors in the architecture document; if yes, continue the analysis.
5. The source code data coupling correctness analysis method based on software architecture according to claim 1, characterized in that, Step 5 further includes: Remove the "Define-Use" pairs between functions within a component from the component variable "Define-Use" draft table. That is, remove the "Define-Use" pairs of variables with the same "Component Name" in the "Define" and "Use" columns. Only keep the "Define-Use" pairs between components to form a valid software component variable "Define-Use" pair table.
6. The source code data coupling correctness analysis method based on software architecture according to claim 1, characterized in that, Step 6 further includes: Based on the valid software component variable "definition-use" pair table, delete the data definition and / or use entries that do not exist in the valid software component variable "definition-use" pair table from the component input and output variable draft table, component variable "definition" draft table, component variable "use" draft table, and component data coupling relationship draft table, respectively, and generate the component input and output variable table, component variable "definition" table, component variable "use" table, and component data coupling relationship draft table.
7. The source code data coupling correctness analysis method based on software architecture according to claim 1, characterized in that, Step 7 further includes: Optimize the arrangement of table content by taking software components as the object: According to the principle of the same "component name", the data with the same component name in the component data coupling relationship draft table are arranged in a centralized manner to obtain the complete input and output interfaces of each component, complete the data coupling relationship analysis between related components, and form a software component data coupling relationship table.
8. The source code data coupling correctness analysis method based on software architecture according to claim 1, characterized in that, Step 8 further includes: Based on the software architecture document, review the consistency of information in the component input / output variable tables, component variable "definition" tables, component variable "usage" tables, and component data coupling relationship tables with the component input / output interface definitions defined in the software architecture, and whether the data flow and control flow between components are consistent. Determine whether the data coupling relationships between the software source code and the components are consistent, and whether the data coupling relationships implemented in the software source code are correct. If there is a discrepancy, record the discrepancy and submit a defect report; otherwise, determine that the software source code implements the component data coupling relationships correctly, and end the analysis.
9. A source code data coupling correctness analysis device based on software architecture, characterized in that, The device includes: The inclusion relationship extraction module is used to extract the inclusion relationships between software components and functions; The coupling analysis result conversion module is used to convert the source code data coupling analysis results into preliminary software component data coupling analysis results; The unassigned redundant function check module is used to check whether there are redundant function modules in the source code that have not been assigned to software components. The Unimplemented Functional Components Check Module is used to check whether the corresponding functional components are not implemented in the software source code. The extraction module is used to extract valid definition-use pairs for software component variables. The filtering module is used to filter out redundant data within software components in the preliminary analysis results of data coupling of software components. The integration module is used to reintegrate the data coupling analysis results of software components; The coupling compliance assessment module is used to review whether the data coupling relationships of software components comply with the software architecture document. The coupling analysis result conversion module is further configured as follows: Based on the source code data coupling analysis results, add a "Component Name" column before the "Function Name" column in the function input / output variable table, function variable "Definition" table, and function variable "Use" table, equivalent to converting them into component input / output variable draft tables, component variable "Definition" draft tables, and component variable "Use" draft tables. Add a "Component Name" column to the definition and use columns of the valid function variable "Definition-Use" pair table, equivalent to converting them into a component variable "Definition-Use" pair draft table. Add three "Component Name" columns before the function names in the source code module data coupling relationship table, equivalent to converting them into a component data coupling relationship draft table. Based on the software component function composition information table, fill the newly added columns in the component input / output variable draft table, component variable "Definition" draft table, component variable "Use" draft table, component variable "Definition-Use" pair draft table, and component data coupling relationship draft table with the component names corresponding to the function names.
10. The source code data coupling correctness analysis device based on software architecture according to claim 9, characterized in that, The inclusion relationship extraction module is further configured as follows: Based on the division of top-level components in the software architecture, and combined with the function call relationships within the software components, the inclusion relationships between software components and functions are sorted out to form a software component function composition information table.
11. The source code data coupling correctness analysis device based on software architecture according to claim 9, characterized in that, The unassigned redundancy function check module is further configured as follows: Filter the component input and output variable drafts, component variable "definition" drafts, component variable "use" drafts, and component variable "definition-use" drafts. Check if there is NA information in the "Component Name" column of the component variable "definition-use" drafts. If so, there are redundant function modules that have not been assigned to the software component, or necessary software component definitions are missing. A defect report should be submitted. Otherwise, continue the analysis.
12. The source code data coupling correctness analysis device based on software architecture according to claim 9, characterized in that, The unimplemented functional component check module is further configured as follows: Continue reviewing whether each component defined in the software component function composition information table can be found in the corresponding data items in each draft table; if not, the corresponding functional components may have been omitted when the software component was implemented as source code, and the inconsistencies need to be recorded, a defect report submitted, and the software designer to supplement the implementation of the corresponding components or revise the textual errors in the architecture document; if yes, continue the analysis.
13. The source code data coupling correctness analysis device based on software architecture according to claim 9, characterized in that, The refining module is further configured as follows: Remove the "Define-Use" pairs between functions within a component from the component variable "Define-Use" draft table. That is, remove the "Define-Use" pairs of variables with the same "Component Name" in the "Define" and "Use" columns. Only keep the "Define-Use" pairs between components to form a valid software component variable "Define-Use" pair table.
14. The source code data coupling correctness analysis device based on software architecture according to claim 9, characterized in that, The filtering module is further configured as follows: Based on the valid software component variable "definition-use" pair table, delete the data definition and / or use entries that do not exist in the valid software component variable "definition-use" pair table from the component input and output variable draft table, component variable "definition" draft table, component variable "use" draft table, and component data coupling relationship draft table, respectively, and generate the component input and output variable table, component variable "definition" table, component variable "use" table, and component data coupling relationship draft table.
15. The source code data coupling correctness analysis device based on software architecture according to claim 9, characterized in that, The integration module is further configured as follows: Optimize the arrangement of table content by taking software components as the object: According to the principle of the same "component name", the data with the same component name in the component data coupling relationship draft table are arranged in a centralized manner to obtain the complete input and output interfaces of each component, complete the data coupling relationship analysis between related components, and form a software component data coupling relationship table.
16. The source code data coupling correctness analysis device based on software architecture according to claim 9, characterized in that, The coupling relationship compliance determination module is further configured as follows: Based on the software architecture document, review the consistency of information in the component input / output variable tables, component variable "definition" tables, component variable "usage" tables, and component data coupling relationship tables with the component input / output interface definitions defined in the software architecture, and whether the data flow and control flow between components are consistent. Determine whether the data coupling relationships between the software source code and the components are consistent, and whether the data coupling relationships implemented in the software source code are correct. If there is a discrepancy, record the discrepancy and submit a defect report; otherwise, determine that the software source code implements the component data coupling relationships correctly, and end the analysis.
Citation Information
Patent Citations
Software architecture security analysis implementation method for railway signal system
CN112612709A
Analysis method, device and analysis tool of application program module
CN113391812A