Software measurement system and method
By converting software engineering files into udb files and performing underlying analysis, the problem of unstandardized data formats and difficult to count measurement results in existing software measurement tools is solved, and the automated calculation and standardized data processing of software measurements are realized, which improves measurement efficiency and scalability.
Patent Information
- Application Number
- CN202411394229.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-08
- Publication Date
- 2025-02-18
AI Technical Summary
Existing software measurement tools have problems such as unstandardized data formats and difficult to count and calculate measurement results. Specialized tools are highly specialized, making it difficult to achieve universality and data standardization.
Provide a software measurement system, including conversion module, underlying analysis module, interface display module and report display module. By converting software engineering files into udb files and performing underlying analysis of udb files, automatically calculate code measurement results, and generate software measurements. Report.
It realizes automated calculation of software measurements, quickly generates measurement results and reports, with high efficiency, standardized data, strong scalability, and is suitable for subsequent project software measurement operations.
Smart Images

Figure CN119473844A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software measurement, and in particular, relates to a software measurement system and method. Background Art
[0002] Software code measurement and static analysis are effective means to ensure code quality. Traditional measurement tools are general or specialized measurement tools. Among them, the data format of the results of general measurement tools does not meet the standardization requirements, and the measurement results are for files and functions, without statistics. It is difficult to obtain statistical results directly from the measurement results, and the workload is large; specialized tools are highly specialized, and require specific parameters to be set or a large number of samples for model training during measurement. They are not universal for software measurement, and the measurement results obtained are also difficult to standardize.
[0003] For example, the Chinese patent with publication number CN116089311A discloses a differentiated software measurement method, device and storage medium, which are applied to the field of software monitoring technology, including: establishing a measurement index pool, setting up three measurement systems, matching different measurement systems according to the attributes of the product itself, so that different measurement indicators can be selected according to the attributes of the product or the importance within the company, and re-matching the measurement system after each life cycle of the product, avoiding the problem that the measurement indicators cannot be updated in real time when the product's own attributes or importance to the company change in different life cycles, and solving the problem that some products in the existing technology are not suitable for the current measurement system when a set of measurement systems is used to measure all software products in the company. However, the measurement standard of the patent includes indicators that cannot be measured in software files, such as user satisfaction and the number of online security risks, which are suitable for software development, but not for direct measurement of software code; and the patent is highly specific, and it is difficult to achieve data format standardization, and each software needs to set corresponding measurement indicators.
[0004] For example, the Chinese patent with the announcement number CN109583476B discloses a software measurement method, system and electronic device based on the software development process. The system includes: a data acquisition module for acquiring data of various dimensions of the software as basic measurement elements; a preprocessing module for converting selected basic measurement elements into derived measurement elements; a software measurement module for processing the input basic measurement elements and the derived measurement elements according to a preset software measurement model to obtain software quality index, user activity index, team activity index and health status perception index, etc. This patent comprehensively and accurately describes the open source project from the dimensions of user activity, team activity, software quality, etc., and generates a software measurement model based on the software development process. Using this software measurement model, the user activity index, team activity index, software quality index and health status perception index of the open source project can be quickly calculated, helping the software team to objectively understand the software status and find problems in time. However, this patent requires building a software measurement model and then selecting measurement elements through the software measurement model. It is highly software-specific and each different software requires samples for corresponding training. The measurement standards include user activity index, team activity index and health status perception index, etc., which are suitable for software development but not for direct measurement of other software codes. Summary of the invention
[0005] In order to solve the above technical problems, the present invention provides a software measurement system and method.
[0006] The present invention is achieved through the following technical solutions.
[0007] The present invention provides a software measurement system, comprising:
[0008] Conversion module: used to obtain all files of a specified software project and convert the software project files into udb files;
[0009] Bottom-level analysis module: used to analyze udb files, obtain software measurement results, and generate software measurement reports based on the software measurement results;
[0010] Interface display module: used to control the software measurement system, connecting the underlying analysis module and the report display module;
[0011] Report display module: used to display software metrics reports.
[0012] Preferably, the conversion module supports UnderstandC++ tool.
[0013] Preferably, the underlying analysis module includes:
[0014] Basic information component: used to measure basic information of the software;
[0015] File information component: used to measure the file information of the software;
[0016] Function information component: used to measure the function information of the software;
[0017] Other information components: used to measure the fan-out information and call parameter information of the software;
[0018] goto statement component: used to determine whether there is a statement with the keyword goto in the software.
[0019] Preferably, the basic information components include:
[0020] Software unit blank line count submodule: used to measure the number of blank lines in a software unit;
[0021] Software unit code lines submodule: used to measure the number of code lines of software units;
[0022] Software unit comment line count submodule: used to measure the number of comment lines of a software unit;
[0023] Software unit total lines submodule: used to measure the total number of lines of a software unit.
[0024] Preferably, the file information component includes:
[0025] Software file code lines submodule: used to measure the number of code lines of software files;
[0026] Software file comment line count submodule: used to measure the number of comment lines in software files;
[0027] Software file total number of lines submodule: used to measure the total number of lines of software files;
[0028] Software unit maximum size submodule: used to measure the maximum size of a software unit.
[0029] Preferably, the function information component includes:
[0030] Function code line count submodule: used to measure the number of code lines of a function;
[0031] Cyclomatic complexity submodule: used to measure cyclomatic complexity;
[0032] Basic complexity submodule: used to measure basic complexity.
[0033] Preferably, the other information components include:
[0034] Fan-out submodule: used to measure the number of lower-level functions called by a function;
[0035] Call parameter submodule: used to measure the number of function parameters.
[0036] Preferably, the report display module supports TXT format.
[0037] A software measurement method, implemented by the above software measurement system, comprises the following steps:
[0038] S1. Import software engineering files through the interface display module;
[0039] S2, convert the software engineering file through the conversion module to obtain the udb file;
[0040] S3. Analyze the udb file through the underlying analysis module to obtain software measurement results, wherein the software measurement results include text measurement, comment measurement, fan-out number, function parameters, cyclomatic complexity, basic complexity and goto statement;
[0041] S4. Generate a software measurement report based on the software measurement results;
[0042] S5. Display the software measurement report through the report display module.
[0043] Preferably, the text metrics include the number of statements in the software unit, the number of executable statements in the software unit, and the total number of statements in the software file;
[0044] The method of analyzing the udb file by the underlying analysis module to obtain the software measurement result includes the following steps:
[0045] S31, judging whether there is a statement with the keyword "goto" in the software through the goto statement component;
[0046] S32, obtaining the number of statements of the software unit, the number of executable statements of the software unit, and the number of comment statements of the software unit through the basic information component;
[0047] S33, obtaining the total number of statements of the software file through the file information component;
[0048] S34, obtaining cyclomatic complexity and basic complexity through the function information component;
[0049] S35, obtaining the fan-out number through the fan-out number submodule;
[0050] S36. Obtain function parameters by calling the parameter submodule.
[0051] The beneficial effects of the present invention are:
[0052] By converting the software engineering files into udb files through the conversion module, and then performing underlying analysis on the udb files and automatically calculating the code metrics, the software measurement results can be quickly collated and reports generated with high efficiency; the obtained data can be standardized, with strong scalability and low cost, and is suitable for subsequent project software measurement operations. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 is a block diagram of a software metrics system provided by an embodiment of the present invention;
[0054] Figure 2 is a flow chart of a software measurement method provided by an embodiment of the present invention;
[0055] Figure 3 It is a module function flow chart provided by an embodiment of the present invention;
[0056] Figure 4 It is a software interface diagram provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0057] The technical solution of the present invention is further described below, but the scope of protection claimed is not limited to the description.
[0058] like Figure 1 As shown, a software measurement system includes:
[0059] Conversion module: used to obtain all files of a specified software project and convert the software project files into udb files;
[0060] The conversion module supports the UnderstandC++ tool.
[0061] Use the UnderstandC++ tool to import and analyze the C++ and Java versions of the software project folders to form files with the suffix udb.
[0062] Bottom-level analysis module: used to analyze udb files, obtain software measurement results, and generate software measurement reports based on the software measurement results;
[0063] The bottom layer analysis module includes:
[0064] Basic information component: used to measure basic information of the software;
[0065] A software unit refers to the smallest unit in software design, and a software file includes several software units. Since Python language is used for programming in this embodiment, the types of software units include modules, functions, and classes.
[0066] The basic information of the software refers to the basic information of the software unit, and the basic information components include:
[0067] Software unit blank line count submodule: used to measure the number of blank lines in a software unit;
[0068] Software unit code lines submodule: used to measure the number of code lines of software units;
[0069] Software unit comment line count submodule: used to measure the number of comment lines of a software unit;
[0070] Software unit total lines submodule: used to measure the total number of lines of a software unit.
[0071] File information component: used to measure the file information of the software;
[0072] Software file information refers to the basic information of the software file, and the file information components include:
[0073] Software file code lines submodule: used to measure the number of code lines of software files;
[0074] Software file comment line count submodule: used to measure the number of comment lines in software files;
[0075] Software file total number of lines submodule: used to measure the total number of lines of software files;
[0076] Software unit maximum size submodule: used to measure the maximum size of a software unit.
[0077] Function information component: used to measure the function information of the software;
[0078] The function information component includes:
[0079] Function code line count submodule: used to measure the number of code lines of a function;
[0080] Cyclomatic complexity submodule: used to measure cyclomatic complexity;
[0081] Basic complexity submodule: used to measure basic complexity.
[0082] Other information components: used to measure the fan-out information and call parameter information of the software;
[0083] The other information components include:
[0084] Fan-out submodule: used to measure the number of lower-level functions called by a function;
[0085] Call parameter submodule: used to measure the number of function parameters.
[0086] goto statement component: used to determine whether there is a statement with the keyword goto in the software.
[0087] Interface display module: used to control the software measurement system, connecting the underlying analysis module and the report display module;
[0088] like Figure 4 As shown, the interface display module builds the interface through Python. Click the "Select" button in the measurement line to select the udb file to be analyzed, and click Check to generate an analysis report.
[0089] Report display module: used to display software metrics reports.
[0090] The report display module supports TXT format.
[0091] like Figure 2 As shown, a software measurement method is implemented by the above-mentioned software measurement system, comprising the following steps:
[0092] S1. Import software engineering files through the interface display module;
[0093] S2, convert the software engineering file through the conversion module to obtain the udb file;
[0094] S3. Analyze the udb file through the underlying analysis module to obtain software measurement results, wherein the software measurement results include text measurement, comment measurement, fan-out number, function parameters, cyclomatic complexity, basic complexity and goto statement;
[0095] The text metrics include the number of statements in a software unit, the number of executable statements in a software unit, and the total number of statements in a software file;
[0096] The method of analyzing the udb file by the underlying analysis module to obtain the software measurement result includes the following steps:
[0097] S31, judging whether there is a statement with the keyword "goto" in the software through the goto statement component;
[0098] S32, obtaining the number of statements of the software unit, the number of executable statements of the software unit, and the number of comment statements of the software unit through the basic information component;
[0099] S33, obtaining the total number of statements of the software file through the file information component;
[0100] S34, obtaining cyclomatic complexity and basic complexity through the function information component;
[0101] S35, obtaining the fan-out number through the fan-out number submodule;
[0102] S36. Obtain function parameters by calling the parameter submodule.
[0103] The present invention can be implemented by scripting languages such as Perl, Python, etc. Figure 3 As shown, this embodiment is implemented by programming in Python language, and the basic information component and the file information component are implemented by the CountLine and CountLineComment modules in the file code;
[0104] The function information component is implemented through the Cyclomatic and Essential modules, where Cyclomatic is the cyclomatic complexity submodule, which obtains the cyclomatic complexity, and Essential is the basic complexity submodule, which obtains the basic complexity;
[0105] The fan-out submodule obtains the number of calls through function, method, and procedure functions, and then determines the number of calls through Call and function to form the fan-out result;
[0106] The calling parameter submodule is implemented through define, parameter function to determine the number of function parameters, that is, function parameters.
[0107] The metrics are shown in the following table:
[0108]
[0109] The annotation metric is the effective annotation rate of the software unit, which is calculated based on the number of annotation statements of the software unit and the number of statements of the software unit.
[0110] S4. Generate a software measurement report based on the software measurement results;
[0111] S5. Display the software measurement report through the report display module.
[0112] The present invention converts software engineering files into udb files through a conversion module, then performs bottom-level analysis on the udb files and automatically calculates code metrics, which can quickly realize software metric result collation and report generation with high efficiency; the obtained data can be standardized, has strong scalability and low cost, and is suitable for subsequent project software metric operations.
Claims
1. A software measurement system, characterized in that: include: Conversion module: used to obtain all files of a specified software project and convert the software project files into udb files; Bottom-level analysis module: used to analyze udb files, obtain software measurement results, and generate software measurement reports based on the software measurement results; Interface display module: used to control the software measurement system, connecting the underlying analysis module and the report display module; Report display module: used to display software metrics reports.
2. The software metric system according to claim 1, characterized in that: The conversion module supports the UnderstandC++ tool.
3. The software metric system according to claim 1, wherein: The bottom layer analysis module includes: Basic information component: used to measure basic information of the software; File information component: used to measure the file information of the software; Function information component: used to measure the function information of the software; Other information components: used to measure the fan-out information and call parameter information of the software; goto statement component: used to determine whether there is a statement with the keyword goto in the software.
4. The software metric system according to claim 3, characterized in that: The basic information components include: Software unit blank line count submodule: used to measure the number of blank lines in a software unit; Software unit code lines submodule: used to measure the number of code lines of software units; Software unit comment line count submodule: used to measure the number of comment lines of a software unit; Software unit total lines submodule: used to measure the total number of lines of a software unit.
5. The software metric system according to claim 3, wherein: The file information component includes: Software file code lines submodule: used to measure the number of code lines of software files; Software file comment line count submodule: used to measure the number of comment lines in software files; Software file total number of lines submodule: used to measure the total number of lines of software files; Software unit maximum size submodule: used to measure the maximum size of a software unit.
6. The software metric system according to claim 3, wherein: The function information component includes: Function code line count submodule: used to measure the number of code lines of a function; Cyclomatic complexity submodule: used to measure cyclomatic complexity; Basic complexity submodule: used to measure basic complexity.
7. The software metric system according to claim 3, characterized in that: The other information components include: Fan-out submodule: used to measure the number of lower-level functions called by a function; Call parameter submodule: used to measure the number of function parameters.
8. The software metric system according to claim 1, wherein: The report display module supports TXT format.
9. A software measurement method, characterized in that: The method is implemented by the software measurement system according to any one of claims 1 to 8, comprising the following steps: S1. Import software engineering files through the interface display module; S2, convert the software engineering file through the conversion module to obtain the udb file; S3. Analyze the udb file through the underlying analysis module to obtain software measurement results, wherein the software measurement results include text measurement, comment measurement, fan-out number, function parameters, cyclomatic complexity, basic complexity and goto statement; S4. Generate a software measurement report based on the software measurement results; S5. Display the software measurement report through the report display module.
10. The software measurement method according to claim 9, characterized in that: The text metrics include the number of statements in a software unit, the number of executable statements in a software unit, and the total number of statements in a software file; The method of analyzing the udb file by the underlying analysis module to obtain the software measurement result includes the following steps: S31, judging whether there is a statement with the keyword "goto" in the software through the goto statement component; S32, obtaining the number of statements of the software unit, the number of executable statements of the software unit, and the number of comment statements of the software unit through the basic information component; S33, obtaining the total number of statements of the software file through the file information component; S34, obtaining cyclomatic complexity and basic complexity through the function information component; S35, obtaining the fan-out number through the fan-out number submodule; S36. Obtain function parameters by calling the parameter submodule.
Citation Information
Patent Citations
Software measurement methods, systems, and electronic devices based on the software development process
CN109583476B
Differentiated software measurement method and device and storage medium
CN116089311A