ArticleslgStudy

computer science

ABC Software Metric

ABC Software Metric is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand ABC Software Metric rather than just read about it. In short: The ABC software metric was introduced by Jerry Fitzpatrick in 1997 to overcome the drawbacks of the LOC. The metric defines an ABC score as a triplet of values that represent the size of a set of source code statements.

Key takeaways

  • ABC Software Metric belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect ABC Software Metric to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of ABC Software Metric from memory before moving on to harder problems.

Reference excerpt

The ABC software metric was introduced by Jerry Fitzpatrick in 1997 to overcome the drawbacks of the LOC. The metric defines an ABC score as a triplet of values that represent the size of a set of source code statements. An ABC score is calculated by counting the number of assignments (A), number of branches (B), and number of conditionals (C) in a program. ABC score can be applied to individual methods, functions, classes, modules or files within a program. ABC score is represented by a 3-D vector < Assignments (A), Branches (B), Conditionals (C) >. It can also be represented as a scalar value, which is the magnitude of the vector < Assignments (A), Branches (B), Conditionals (C) >, and is calculated as follows:

|<ABCvector>|=A2+B2+C2 By convention, an ABC magnitude value is rounded to the nearest tenth.

History The concept of measuring software size was first introduced by Maurice Halstead from Purdue University in 1975. He suggested that every computer program consists mainly of tokens: operators and operands. He concluded that a count of the number of unique operators and operands gives us a measure of the size of the program. However, this was not adopted as a measure of the size of a program. Lines of code (LOC) was another popular measure of the size of a program. The LOC was not considered an accurate measure of the size of the program because even a program with identical functionality may have different numbers of lines depending on the style of coding. Another metric called the Function Point (FP) metric was introduced to calculate the number of user input and output transactions. The function point calculations did not give information about both the functionality of the program nor about the routines that were involved in the program. The ABC metric is intended to overcome the drawbacks of the LOC, FP and token (operation and operand) counts. However, an FP score can also be used to supplement an ABC score. Though the author contends that the ABC metric measures size, some believe that it measures complexity. The ability of the ABC metric to measure complexity depends on how complexity is defined.

Definition The three components of the ABC score are defined as following:

Assignment: storage or transfer of data into a variable. Branches: an explicit forward program branch out of scope. Conditionals: Boolean or logic test. Since basic languages such as C, C++, Java, etc. have operations like assignments of variables, function calls and test conditions only, the ABC score has these three components. If the ABC vector is denoted as ⟨5,11,9⟩ for a subroutine, it means that the subroutine has 5 assignments, 11 branches and 9 conditionals. For standardization purposes, the counts should be enclosed in angle brackets and written in the same order per the notation ⟨A, B, C⟩. It is often more convenient to compare source code sizes using a scalar value. The individual ABC counts are distinct so, per Jerry Fitzpatrick, we consider the three components to be orthogonal, allowing a scalar ABC magnitude to be computed as shown above. Scalar ABC scores lose some of the benefits of the vector. Instead of computing a vector magnitude, the weighted sum of the vectors may support more accurate size comparison. ABC scalar scores should not be presented without the accompanying ABC vectors, since the scalar values are not the complete representation of the size.

Theory The specific rules for counting ABC vector values should be interpreted differently for different languages due to semantic differences between them. Therefore, the rules for calculating ABC vector slightly differ based on the language. We define the ABC metric calculation rules for C, C++ and Java below. Based on these rules the rules for other imperative languages can be interpreted.

ABC rules for C The following rules give the count of Assignments, Branches, Conditionals in the ABC metric for C:

Add one to the assignment count when: Occurrence of an assignment operator (=, *=, /=, %=, +=, -=, <<=, >>=, &=, !=, ^=). Occurrence of an increment or a decrement operator (++, --). Add one to branch count when: Occurrence of a function call. Occurrence of any goto statement which has a target at a deeper level of nesting than the level to the goto. Add one to condition count when: Occurrence of a conditional operator (<, >, <=, >=, ==, !=). Occurrence of the following keywords (‘else’, ‘case’, ‘default’, ‘?’). Occurrence of a unary conditional operator.

ABC rules for C++ The following rules give the count of Assignments, Branches, Conditionals in the ABC metric for C++:

Add one to the assignment count when: Occurrence of an assignment operator (exclude constant declarations and default parameter assignments) (=, *=, /=, %=, +=, -=, <<=, >>=, &=, !=, ^=). Occurrence of an increment or a decrement operator (prefix or postfix) (++, --). Initialization of a variable or a nonconstant class member. Add one to branch count when: Occurrence of a function call or a class method call. Occurrence of any goto statement which has a target at a deeper level of nesting than the level to the goto. Occurrence of ‘new’ or ‘delete’ operators. Add one to condition count when: Occurrence of a conditional operator (<, >, <=, >=, ==, !=). Occurrence of the following keywords (‘else’, ‘case’, ‘default’, ‘?’, ‘try’, ‘catch’). Occurrence of a unary conditional operator.

ABC rules for Java The following rules give the count of Assignments, Branches, Conditionals in the ABC metric for Java:

Add one to the assignment count when: Occurrence of an assignment operator (exclude constant declarations and default parameter assignments) (=, *=, /=, %=, +=, -=, <<=, >>=, &=, !=, ^=, >>>=). Occurrence of an increment or a decrement operator (prefix or postfix) (++, --). Add one to branch count when Occurrence of a function call or a class method call. Occurrence of a ‘new’ operator. Add one to condition count when: Occurrence of a conditional operator (<, >, <=, >=, ==, !=). Occurrence of the following keywords (‘else’, ‘case’, ‘default’, ‘?’, ‘try’, ‘catch’). Occurrence of a unary conditional operator.

Applications

Independent of coding style Since the ABC score metric is built on the idea that tasks like data storage, branching and conditional testing, this metric is independent of the user's style of coding.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with ABC Software Metric

Start with the simplest possible case. Write down what ABC Software Metric claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to ABC Software Metric before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about ABC Software Metric ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of ABC Software Metric

In research
ABC Software Metric appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses ABC Software Metric in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
ABC Software Metric is common in secondary-school and first-year university syllabi. It links to neighbouring topics Software metrics, so understanding it makes those chapters shorter.
In everyday life
Look for ABC Software Metric outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “ABC Software Metric” →

How to study ABC Software Metric in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what ABC Software Metric means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain ABC Software Metric out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is ABC Software Metric in simple terms?

The ABC software metric was introduced by Jerry Fitzpatrick in 1997 to overcome the drawbacks of the LOC. The metric defines an ABC score as a triplet of values that represent the size of a set of source code statements.

Why does ABC Software Metric matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study ABC Software Metric?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on ABC Software Metric.

Tags

  • Software metrics

Keep exploring