ABC Software Metric

The ABC software metric was introduced by Jerry Fitzpatrick in 1997 to overcome the drawbacks of the LOC.[1] 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:

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[2] 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.[3]

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.[4]

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.[5] 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.[1]

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.[1]

ABC rules for C

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

  1. Add one to the assignment count when:
  2. 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.
  3. 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++:

  1. 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.
  2. 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.
  3. 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:

  1. 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) (++, --).
  2. Add one to branch count when
    • Occurrence of a function call or a class method call.
    • Occurrence of a ‘new’ operator.
  3. 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

[1]

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.

Project time estimation

ABC score calculation helps in estimating the amount of time needed to complete a project. This can be done by roughly estimating the ABC score for the project, and by calculating the ABC score of the program in a particular day. The amount of time taken for the completion for the project can be obtained by dividing the ABC score of the project by the ABC score achieved in one day.

Bug rate calculation

The bug rate was originally calculated as Number of bugs / LOC. However, the LOC is not a reliable measure of the size of the program because it depends on the style of coding. A more accurate way of measuring bug rate is to count the - Number of bugs / ABC score.

Program comparison

Programs written in different languages can be compared with the help of ABC scores because most languages use assignments, branches and conditional statements.

The information on the count of the individual parameters (number of assignments, branches and conditions) can help classify the program as ‘data strong’ or ‘function strong’ or ‘logic strong’. The vector form of an ABC score can provide insight into the driving principles behind the application, whereas the details are lost in the scalar form of the score.

Linear metric

ABC scores are linear, so any file, module, class, function or method can be scored. For example, the (vector) ABC score for a module is the sum of the scores of its sub-modules. Scalar ABC scores, however, are non-linear.

See also

References

  1. ^ a b c d Fitzpatrick, Jerry (1997). "Applying the ABC metric to C, C++ and Java" (PDF). C++ Report.
  2. ^ Halstead, Maurice (1977). Elements of Software Science. North Holland: Elsevier.
  3. ^ Fenton, Norman E. (1991). "Software Metrics: Successes, Failures and New Directions" (PDF). Chapman & Hall.
  4. ^ Kitchenham, Barbara (December 1995). "Towards a Framework for Software Measurement Validation". IEEE Transactions on Software Engineering. 21 (12): 929–944. doi:10.1109/32.489070. S2CID 8608582.
  5. ^ Fitzpatrick, Jerry (2017). "Appendix A". Timeless Laws of Software Development. Software Renovation Corporation. ISBN 978-0999335604.

Read other articles:

Final Piala Raja Spanyol 1927TurnamenPiala Raja Spanyol 1927 Real Unión Arenas 1 0 Tanggal15 Mei 1927StadionStadion Torrero, ZaragozaWasitPedro EscartínPenonton16.000← 1926 1928 → Final Piala Raja Spanyol 1927 adalah pertandingan final ke-25 dari turnamen sepak bola Piala Raja Spanyol untuk menentukan juara musim 1927. Pertandingan ini diikuti oleh Real Unión dan Arenas dan diselenggarakan pada 15 Mei 1927 di Stadion Torrero, Zaragoza. Real Unión memenangkan pertandingan ini d...

 

Komando Lintas Laut MiliterLambang KolinlamilAktif1 Juli 1961Negara IndonesiaTipe unitAngkutan Laut MiliterBagian dariTNI Angkatan LautMarkasJakarta Utara, DKI JakartaMotoSatya Wira Jala DharmaBaret BIRU LAUT Situs webhttps://kolinlamil.tnial.mil.id/TokohPanglimaLaksamana Muda TNI Hudiarto Krisno Utomo, M.A., M.M.S., P.S.C.(Joint)., CHRMP.Kepala StafLaksamana Pertama TNI Mochamad Riza, S.E., M.Tr.Opsla., CRMP.InspekturLaksamana Pertama TNI Damayanti, S.H., M.M.DandenmaKolonel L...

 

The Hertzberg Clock in 2014 The Hertzberg Clock is an historic landmark and visitor attraction[1] located at the corner of N. St. Mary's and Houston streets in the Bexar County city of San Antonio in the U.S. state of Texas.[2] Installed in 1878 in front of Eli Hertzberg Jewelry Company, it was made by E. Howard & Co. of Boston, Massachusetts. The freestanding town clock was donated to the San Antonio Conservation Society in 1982 by the daughters of its original owners, Ma...

40e cérémonie des Saturn Awards Saturn Awards Organisée par Académie des films de science-fiction, fantastique et horreur Détails Date 26 juin 2014 Lieu Burbank États-Unis Site web http://www.saturnawards.org/ Chronologie 39e cérémonie des Saturn Awards 41e cérémonie des Saturn Awards modifier  La 40e cérémonie des Saturn Awards, récompensant les films, séries télévisées et téléfilms sortis en 2013 et les professionnels s'étant distingués cette a...

 

This article relies excessively on references to primary sources. Please improve this article by adding secondary or tertiary sources. Find sources: The Sun and the Moon Complete – news · newspapers · books · scholar · JSTOR (March 2008) (Learn how and when to remove this template message) 2008 remix album by The BraveryThe Sun and the Moon CompleteRemix album by The BraveryReleased March 18, 2008Recorded2007/ 2008GenreIndie rock, electronica, ...

 

Eraldo Bedendo Nazionalità  Italia Calcio Ruolo Mediano Termine carriera 1941 Carriera Giovanili 192?-1928 Adria[1] Squadre di club1 1928-1932 Padova108 (20)1932-1935 Napoli31 (0)1935-1936 Livorno17 (1)1936-1941 Vicenza101 (4) Carriera da allenatore 1939-1940 Vicenza1945-1946 Vicenza(subentrato a Prendato) 1 I due numeri indicano le presenze e le reti segnate, per le sole partite di campionato.Il simbolo → indica un trasferimento in prestito...

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: 4 South African Infantry Battalion – news · newspapers · books · scholar · JSTOR (October 2019) (Learn how and when to remove this message) 4 South African Infantry Battalion4 SAI emblemActive1 January 1962 to presentCountry South AfricaBranch South A...

 

California Attorney General elections 2010 California Attorney General election ← 2006 November 2, 2010 2014 →   Nominee Kamala Harris Steve Cooley Party Democratic Republican Popular vote 4,442,781 4,368,624 Percentage 46.1% 45.3% County results Congressional district resultsHarris:      40–50%      50–60%      60–70%      70–80% Cooley:   ...

 

American singer (born 1963) Ed RolandRoland at Eddie's Attic in Decatur, Georgia (2021)BornEdgar Eugene Roland Jr. (1963-08-03) August 3, 1963 (age 60)Stockbridge, Georgia, U.S.Occupations Singer musician songwriter record producer Years active1985–presentSpouses Stephanie Boley ​ ​(m. 1996; div. 2001)​ Michaeline Matteson ​(m. 2006)​ Children2RelativesDean Roland (brother)Musical careerOriginStockbridge,...

Historic district in Manhattan, New York United States historic placeSniffen Court Historic DistrictU.S. National Register of Historic PlacesU.S. Historic districtNew York City Landmark (2012)Locationoff East 36th Streetbetween Third and Lexington AvenuesManhattan, New York CityCoordinates40°44′49″N 73°58′41″W / 40.74694°N 73.97806°W / 40.74694; -73.97806Built1863-1864Built byJohn SniffenArchitectural styleEarly Romanesque revivalNRHP reference...

 

Secret metro line below Moscow between Russian government facilities This article is about a rumored transit system. For the credit reporting data specification, see Metro 2 format.This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Metro-2 – news · newspapers · books · scholar · JSTOR (October 2023) (Learn how ...

 

Gubernur Sulawesi TengahLambang Sulawesi TengahPetahanaRusdy Masturasejak 16 Juni 2021KediamanGubernuran SiranindiMasa jabatan5 tahunDibentuk13 April 1964; 60 tahun lalu (1964-04-13)Pejabat pertamaAnwar Datuk Madjo Basa Nan KuningSitus webSitus web resmi Gubernur Sulawesi Tengah adalah posisi tertinggi dalam pemerintahan provinsi Sulawesi Tengah. Dalam menjalankan roda pemerintahan daerah, Gubernur didampingi oleh Wakil Gubernur. Jabatan Gubernur Sulawesi Tengah saat ini dijabat ole...

Mass shooting in Derry, Northern Ireland For other events of the same name, see Bloody Sunday. Bloody SundayPart of the TroublesThe Catholic priest Edward Daly waving a blood-stained white handkerchief while trying to escort the mortally wounded Jackie Duddy to safetyLocationDerry,[n 1] Northern IrelandCoordinates54°59′49″N 07°19′32″W / 54.99694°N 7.32556°W / 54.99694; -7.32556Date30 January 1972; 52 years ago (1972-01-30) 16:10 (U...

 

2015 film The correct title of this article is Persona 3 The Movie: #3 Falling Down. The substitution of the # is due to technical restrictions. Persona 3 The Movie: #3 Falling DownTheatrical release poster. Right caption reads, Time does not wait. It delivers us all equally to the same end.Directed byKeitaro MotonagaWritten byJun KumagaiStory byAtlusBased onPersona 3by AtlusStarringAkira IshidaMegumi ToyoguchiKōsuke ToriumiRie TanakaHikaru MidorikawaMamiko NotoMaaya SakamotoMegumi OgataKazu...

 

Le Maine parmi les anciennes provinces de France. Le Maine est une région historique et une ancienne province située dans l'Ouest de la France. Entouré par des régions plus affirmées comme la Bretagne, la Normandie ou encore l'Anjou, le Maine occupe une zone de transition, à cheval sur le Massif armoricain et le Bassin parisien. À ce titre, le Maine est une sorte de carrefour des paysages : sa frange occidentale évoque la Bretagne, l'Est est rempli de collines comme le paysage de...

Polikarbonat adalah suatu kelompok polimer termoplastik, mudah dibentuk dengan menggunakan panas. Plastik jenis ini digunakan secara luas dalam industri kimia saat ini. Plastik ini memiliki banyak keunggulan, yaitu ketahanan termal dibandingkan dengan plastik jenis lain, tahan terhadap benturan, dan sangat bening. Dalam identifikasi plastik, polikarbonat berada pada nomor 7. Polikarbonat disebut demikian karena plastik ini terdiri dari polimer dengan gugus karbonat (-O-(C=O)-O-) dalam rantai ...

 

British actress Pauline CollinsOBECollins in 2012Born (1940-09-03) 3 September 1940 (age 83)Exmouth, Devon, EnglandAlma materRoyal Central School of Speech and DramaOccupationActressYears active1963–presentSpouse John Alderton ​(m. 1969)​Children4 Pauline Collins OBE (born 3 September 1940)[1] is a British actress who first came to prominence portraying Sarah Moffat in Upstairs, Downstairs (1971–1973) and its spin-off Thomas & Sarah ...

 

League of Legends esports tournament This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: 2021 Mid-Season Invitational – news · newspapers · books · scholar · JSTOR (May 2021) (Learn how and when to remove this message) 2021 Mid-Season InvitationalTournament informationSportLeague of LegendsLocationIcelandDates6 ...

BPScrystal structure of the grb14 bps region in complex with the insulin receptor tyrosine kinaseIdentifiersSymbolBPSPfamPF08947InterProIPR015042Available protein structures:Pfam  structures / ECOD  PDBRCSB PDB; PDBe; PDBjPDBsumstructure summary In molecular biology, the BPS domain (Between PH and SH2) domain is a protein domain of approximately 45 amino acids found in the adaptor proteins Grb7/|Grb10/Grb14. It mediates inhibition of the tyrosine kinase domain of the insulin recepto...

 

Artikel ini membutuhkan rujukan tambahan agar kualitasnya dapat dipastikan. Mohon bantu kami mengembangkan artikel ini dengan cara menambahkan rujukan ke sumber tepercaya. Pernyataan tak bersumber bisa saja dipertentangkan dan dihapus.Cari sumber: Penyebaran Islam di Sudan – berita · surat kabar · buku · cendekiawan · JSTOR (Februari 2023) Pembagian geografis antara mayoritas pemeluk agama Islam dan Kristen di Afrika. Bagian barat kerajaan-kerajaan Sah...