Patent ID: 11860764
Assignee: SIEMENS AKTIENGESELLSCHAFT
Field: Computer technology (Electrical engineering)
Classification: CPC G | IPC G

Claim 10:
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 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;

a prediction result determining module configured to input the probabilities of each of the error-prone patterns into an artificial neural network and, based on the artificial neural network, connect the probabilities of each of the error-prone patterns to design principles, determine a prediction result of whether the code violates the design principles, and determine a quantified degree to which the code violates the design principles; and
an evaluation module configured to evaluate the design quality of the code based on the prediction result.