OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

sarif message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Followup on code metrics



Iâm following up on our meeting yesterday with some material on code metrics.


There are a couple of metric âfamiliesâ that are commonly used. The first are simple line counts. Itâs common for tools to have several varieties such as raw lines, non-blank lines, lines with comments, etc. There are also a few metrics that count syntactic constructs in various ways, such as nesting depth.


Then there is the McCabe family which contains the much misunderstood Cyclomatic Complexity and a few relatives that attempt to compensate for its shortcomings; e.g. Essential Complexity, and Module Design Complexity.


The Halstead metrics are an antiquated family that are based on counting tokens in various ways. They donât appear to be widely used any more.


There are a bunch of Object-oriented metrics that are often about the relationship between classes: coupling, cohesion, etc.


I mentioned metrics used in the embedded industry and how thereâs a need for this to be more standardized. A metrics collection that seems to be popular in automotive is the HIS/KGAS set https://docplayer.net/6136232-His-source-code-metrics.html. Hereâs a blog I wrote a little while ago that picks on one particular metric used in that set: https://blogs.grammatech.com/why-npath-is-a-terrible-code-metric.


As I said in the meeting, metrics have numeric values, but we should also allow for exceptional results. For example:

  • Computing the metric leads to a numeric error such as divide by zero
  • The metric canât be computed because itâs inapplicable for some reason
  • The value canât be reasonably expressed (e.g., a path count metric can easily yield 30-40 digit decimal values)
  • The value is infinity (which kind of infinity probably doesnât matter ð)

Thereâs some overlap between these of course. Iâve seen them all in real life.






Paul Anderson, VP of Engineering, GrammaTech, Inc.

531 Esty St., Ithaca, NY 14850

Tel: +1 607 273-7340 x118; https://www.grammatech.com


The information contained in this e-mail and any attachments from GrammaTech, Inc may contain confidential and/or proprietary information, and is intended only for the named recipient to whom it was originally addressed. If you are not the intended recipient, any disclosure, distribution, or copying of this e-mail or its attachments is strictly prohibited. If you have received this e-mail in error, please notify the sender immediately by return e-mail and permanently delete the e-mail and any attachments.

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]