From an article by Jerry Fitzpatrick originally published in C++ Report, June 1997. http://www.softwarerenovation.com/ABCMetric.pdf
ABC is strictly a software size metric, although it has often been misconstrued as a complexity metric.
Size is computed by counting the number of assignments, branches and conditions for a section of code. The counting rules in the original C++ Report article were specifically for the C, C++ and Java languages, and defined as:
- Assignment -- an explicit transfer of data into a variable, e.g. = *= /= %= += <<= >>= &= |= ^= >>>= ++ --
- Branch -- an explicit forward program branch out of scope -- a function call, class method call, or new operator
- Condition -- a logical/Boolean test, == != <= >= < > else case default try catch ? and unary conditionals.
A scalar ABC size value (or "aggregate magnitude") is computed as:
|ABC| = sqrt((A*A)+(B*B)+(C*C))
The individual A, B and C counts provide distinct information about the code that the overall size value doesn't. For example, the B (branch) count is virtually identical to "cyclomatic complexity".
Due to syntax differences, the ABC counting rules for a specific language must generally be tweaked to fulfill the goals of the metric. Futhermore, the metric is probably unsuitable for non-imperative languages (e.g. Prolog).
See CyclomaticComplexityMetric, LinesOfCode, FunctionPoint