Method, apparatus, and system for evaluating code design quality

US11860764B2 · US · B2

Patent metadata
FieldValue
Publication numberUS-11860764-B2
Application numberUS-201917441781-A
CountryUS
Kind codeB2
Filing dateMar 26, 2019
Priority dateMar 26, 2019
Publication dateJan 2, 2024
Grant dateJan 2, 2024

How to read this patent

A practical reading order for non-experts. Skip the full description unless you need deep technical detail.

  1. Title

    What the patent document calls the invention.

  2. Abstract

    A short plain-language summary of the technical disclosure.

  3. Assignees and inventors

    Who owns or filed the patent and who is credited as inventor.

  4. Key dates

    Filing, priority, publication, and grant dates set the timeline.

  5. First independent claim

    The legal scope of protection — read this for what is actually claimed.

  6. CPC / IPC classifications

    Technology tags used to group this patent with similar filings.

  7. Citations and related patents

    Prior art links and similar publications in this corpus.

Abstract

Official abstract text for this publication.

A method, an apparatus, and a system are for evaluating code design quality. The method for evaluating code design quality includes: determining, based upon a result from static scanning of code, a probability of the presence of an error-prone pattern in the code; inputting the probability into an artificial neural network, and determining, based upon the artificial neural network, a prediction result for whether the code violates a preset design rule and for a quantized degree to which the design rule is violated; and based upon the prediction result, evaluating the design quality of the code. The present method is able to improve the accuracy of code design quality evaluation. By detecting a presence of an error-prone pattern in the code, whether or not a key design rule has been violated in a design process and a quantized degree to which the key design rule is violated are predicted.

First claim

Opening claim text (preview).

The invention claimed is: 1. A method for evaluating code design quality, comprising: receiving a modification record of the code; determining probabilities of error-prone patterns in a code based on a compound logic conditional expression including at least one of a result of static scanning of the code and the modification record, including at least one of, determining a probability of an existence of a shotgun surgery based on a compound logic conditional expression including metrics of afferent coupling, efferent coupling and changing method, determining a probability of an existence of a divergent change based on a compound logic conditional expression including metrics of revision number, instability and afferent coupling, determining a probability of an existence of a big design up front based on a compound logic conditional expression including metrics of line of code, line of changed code, class number, changed class number and a statistical average of the metrics, determining a probability of an existence of a scattered/redundant functionality based on a compound logic conditional expression including metrics of structure similarity and logic similarity, determining a probability of an existence of a long method based on a compound logic conditional expression including a metric of cyclomatic complexity, determining a probability of an existence of a complex class based on a compound logic conditional expression including metrics of line of code, attribute number, method number and maximum method cyclomatic complexity, determining a probability of an existence of a long parameter list based on a compound logic conditional expression including a metric of parameter number, or determining a probability of an existence of a message chain based on a compound logic conditional expression including a metric of indirect calling number; inputting the probabilities of each of the error-prone patterns into an artificial neural network; based on the artificial neural network, connecting the probabilities of each of the error-prone patterns to design principles; based on the artificial neural network and the connections, determining a prediction result of whether the code violates the design principles and a quantified degree to which the code violates the design principles; and evaluating the design quality of the code based on the prediction result. 2. The method for evaluating code design quality of claim 1 , wherein at least one of, the error-prone patterns include at least one of: shotgun surgery, divergent change, big design up front, scattered/redundant functionality, cyclic dependency, bad dependency, complex class, long method, code duplication, long parameter list, message chain, and unused method; and the design principles include at least one of: Separation of Concerns, Single Responsibility Principle, Least Knowledge, Don't Repeat Yourself, and Minimize Upfront Design. 3. The method for evaluating code design quality of claim 1 , wherein thresholds in the compound logic conditional expression are adjustable. 4. The method for evaluating code design quality of claim 1 , wherein the artificial neural network comprises connections between the error-prone patterns and design principles; and wherein the determining, based on the artificial neural network, of the prediction result of whether the code violates a design principle and a quantified degree to which the code violates the design principle comprises: obtaining, based on the connections in the artificial neural network and probabilities of the error-prone patterns, a prediction result of whether the code violates the design principles and a quantified degree to which the code violates the design principles. 5. The method for evaluating code design quality of claim 4 , further comprising: adjusting weights of the connections in the artificial neural network based on a self-learning algorithm. 6. The method for evaluating code design quality of claim 4 , wherein the connections between the error-prone patterns and the design principles include at least one of: a connection between shotgun surgery and Separation of Concerns; a connection between shotgun surgery and Single Responsibility Principle; a connection between divergent change and Separation of Concerns; a connection between divergent change and Single Responsibility Principle; a connection between big design up front and Minimize Upfront Design; a connection between scattered functionality and Don't Repeat Yourself; a connection between redundant functionality and Don't Repeat Yourself; a connection between cyclic dependency and Separation of Concerns; a connection between cyclic dependency and Least Knowledge; a connection between bad dependency and Separation of Concerns; a connection between bad dependency and Least Knowledge; a connection between complex class and Single Responsibility Principle; a connection between long method and Single Responsibility Principle; a connection between code duplication and Don't Repeat Yourself; a connection between long parameter list and Single Responsibility Principle; a connection between message chain and Least Knowledge; and a connection between unused method and Minimize Upfront Design. 7. The method for evaluating code design quality of claim 1 , wherein the evaluating of the design quality of the code based on the prediction result comprises at least one of: evaluating the design quality of the code based on whether it violates a design principle, wherein not violating the design principle is relatively better in the design quality than violating the design principle; and evaluating the design quality of the code based on the quantified degree to which the design principle is violated, wherein the quantified degree to which the design principle is violated is inversely proportional to how good the design quality is evaluated to be. 8. A non-transitory computer-readable storage medium, storing computer-readable instructions, the computer-readable instructions being usable to cause at least one processor to, when executed, carry out the method for evaluating code design quality of claim 1 . 9. The method for evaluating code design quality of claim 1 , further comprising: outputting one or more of the design principles having the highest values of the quantified degree. 10. The method for evaluating code design quality of claim 1 , wherein the modification record of the code includes a history of one or more of additions, deletions, changes, or revisions of the code. 11. An apparatus for evaluating code design quality, comprising: a determining module configured to determine probabilities of error-prone patterns in a code based on a compound logic conditional expression including at least one of a result of a static scanning and a modification record of the code, determining the probabilities of error-prone patterns in the code includes at least one of, determining a probability of an existence of a shotgun surgery based on a compound logic conditional expression including metrics of afferent coupling, efferent coupling and changing method, determining a probability of an existence of a divergent change based on a compound logic conditional expression including metrics of revision number, instability and afferent coupling, determining a probability of an existence of a big design up front based on a compound logic conditional expression including metrics of line of code, line of changed code, class number, changed class number and a statistical average of the metrics, determining a probability of an existence of a scattered/redundant functionality based on a compound logic conditional expression including m

Assignees

Inventors

Classifications

  • using software metrics · CPC title

  • Analysis of software for verifying properties of programs (testing of software G06F11/3668) · CPC title

  • Non-supervised learning, e.g. competitive learning · CPC title

  • Backpropagation, e.g. using gradient descent · CPC title

  • Software metrics · CPC title

Patent family

Related publications grouped by family.

External sources

Frequently asked questions

Answers are generated from the same data shown on this page.

What does patent US11860764B2 cover?
A method, an apparatus, and a system are for evaluating code design quality. The method for evaluating code design quality includes: determining, based upon a result from static scanning of code, a probability of the presence of an error-prone pattern in the code; inputting the probability into an artificial neural network, and determining, based upon the artificial neural network, a prediction…
Who is the assignee on this patent?
Siemens Ag, Siemens Ag
What technology area does this patent fall under?
Primary CPC classification G06F11/3616. Mapped technology areas include Physics.
When was this patent published?
Publication date Tue Jan 02 2024 00:00:00 GMT+0000 (Coordinated Universal Time) (B2). Legal status and post-grant events are not shown on this page.
What related patents are in patentsdb?
We list 6 related publications on this page (citations in our corpus or others sharing the same primary CPC).