Você está na página 1de 14

TIOBE Quality Indicator TIOBE Software

The TIOBE Quality Indicator


a pragmatic way of measuring code quality
Document ID: TIOBE-2020!"#
Version: # $aut%ori&ed'
Date: 2-(an-20)
Author: *aul#+ansen,tio-e#com
- -
Code Quality
Project
XYZ
B
A
E
F
D
C
XYZ
Model 3.2
Higher Quality
Lower Quality
C
TIO! Quality I"dicator
#2.33
$%a&ed o" TQI de'i"itio" (.)*
Mea&ure+e"t ,er'or+ed- ./0e,/21(2
Code Co2erage 3 B C 4 ! 5
3%&tract I"ter,retatio" 3 C D ! 5
Cyclo+atic Co+,le6ity
3 C D ! 5
3 B C 4 ! 5
Co+,iler 7ar"i"g&
Codi"g 0ta"dard&
3 C D ! 5
Code 4u,licatio"
3 B C 4 ! 5
3 C D ! 5
5a" Out
3 C 4 ! 5
4ead Code
A C 4 ! 5
Mea&ured %y-
Thi& ,roduct ha& %ee" te&ted with ut+o&t care
agai"&t the TIO! Quality I"dicator de'i"itio".
The de'i"itio" ca" %e 'ou"d at www.tio%e.co+.
TIOBE Quality Indicator TIOBE Software
Table of Contents
1 Introduction.................................................................................................................................
!oft"are Quality Attributes.........................................................................................................
# !oft"are $etrics..........................................................................................................................#
% $a&&in' !oft"are $etrics to Quality Attributes.........................................................................#
( $easurin' and )ud'in' $etric Values.........................................................................................*
+ TIOBE Com&liance Factor...........................................................................................................11
* TIOBE Quality Indicator.............................................................................................................1
!# Scope#####################################################################################################################################2
, Conclusions.................................................................................................................................1
A&&endi- A .eferences.................................................................................................................1#
A&&endi- B .e/ie"ers...................................................................................................................1#
1 Introduction
T%e pro.er- /t%e proof of t%e pudding is in t%e eating/ applies perfectly to software quality# Because only
after a software product %as -een s%ipped0 t%e true quality of a software product re.eals itself# Software
quality is determined -y
t%e num-er of defects found after release
t%e se.erity of t%ese defects
t%e effort needed to sol.e t%ese defects
1ore t%an )0 years ago0 software engineer Barry Boe%m already o-ser.ed t%at t%e costs of repairing defects
increase e2ponentially if t%ey are found later on in t%e software de.elopment process 34# So if it is possi-le
to %a.e a way to measure t%e software quality of a system -efore release0 it will potentially sa.e a lot of
money#
T%e goal of t%is document is to define suc% a software quality measurement system -ased on a pragmatic
approac%# T%e focus is on code quality $as opposed to e#g# quality of requirements or t%e arc%itecture'# T%e
defined approac% is -ased on more t%an 0 years of e2perience in t%is field and t%e analysis of more t%an
200 million lines of industrial production software code t%at are c%ec5ed eac% day#
!oft"are Quality Attributes
T%ere is an ISO definition of software quality0 called ISO 2600 324# T%is standard defines " main quality
factors and a lot of su-attri-utes# T%e " main quality factors are:
Functional suitability# T%e degree to w%ic% t%e product pro.ides functions t%at meet stated and
implied needs w%en t%e product is used under specified conditions#
.eliability# T%e degree to w%ic% a system or component performs specified functions under
specified conditions for a specified period of time#
0erformance efficiency# T%e performance relati.e to t%e amount of resources used under stated
conditions#
O&erability# T%e degree to w%ic% t%e product %as attri-utes t%at ena-le it to -e understood0
learned0 used and attracti.e to t%e user0 w%en used under specified conditions#
!ecurity# T%e degree of protection of information and data so t%at unaut%ori&ed persons or
systems cannot read or modify t%em and aut%ori&ed persons or systems are not denied access to
t%em#
Com&atibility# T%e degree to w%ic% two or more systems or components can e2c%ange information
- 2 -
TIOBE Quality Indicator TIOBE Software
and7or perform t%eir required functions w%ile s%aring t%e same %ardware or software en.ironment#
$aintainability# T%e degree of effecti.eness and efficiency wit% w%ic% t%e product can -e
modified#
Transferability# T%e degree to w%ic% a system or component can -e effecti.ely and efficiently
transferred from one %ardware0 software or ot%er operational or usage en.ironment to anot%er#
T%e ISO 2600 standard %elps as a starting point to determine quality in an early stage# It %as 2 main
draw-ac5s0 %owe.er:
T%e standard does not specify %ow to measure quality attri-utes# Some of t%e quality attri-utes
e.en seem unfit for o-(ecti.e measurement# Ta5e /Opera-ility/ for instance0 wit% su-attri-utes suc%
as /8ttracti.eness/ and /Ease of 9se/# :ow to measure t%is and w%at is t%e unit of measurement;
1ost of t%e quality attri-utes defined %a.e different meanings in different conte2ts# So e.en if it is
possi-le to measure a quality attri-ute0 it is impossi-le to define clear o-(ecti.e criteria for w%at is
considered good or -ad# /*erformance efficiency/ is a good e2ample of suc% a quality attri-ute# <or
some software systems a response wit%in second is sufficient0 w%ereas ot%ers demand a response
wit%in millisecond#
# !oft"are $etrics
=e could try to define measurement systems for t%e ISO quality attri-utes in a top-down scientific way#
:owe.er0 t%is is too am-itious#
>an we measure anyt%ing at all; ?es0 -ut we need to ta5e a more pragmatic approac%# @ots of metrics are
applied to software code nowadays0 -ut unfortunately t%ere is insufficient proof $yet' w%et%er t%ese metrics
contri-ute to -etter code# E2amples of suc% metrics are cyclomatic comple2ity 3)40 code duplication 3A4 and
all 5inds of code co.erage 364# T%ese metrics are appro2imations of some of t%e quality attri-utes of t%e ISO
2600 standard#
To o-tain a systematic way of measuring and qualifying t%ese measurements0 t%e " most commonly used
software code quality metrics in industry today %a.e -een selected t%at can -e measured in an automated
way# T%ese are:
# >ode co.erage
2# 8-stract interpretation 3B4
)# >yclomatic comple2ity
A# >ompiler warnings
6# >oding standards 3!4
B# >ode duplication
!# <an out 3"4
"# Cead code 3D4
% $a&&in' !oft"are $etrics to Quality Attributes
=e define t%e metrics of t%e pre.ious section and map t%em on t%e quality attri-utes of t%e ISO 2600
standard#
# Code co/era'e# Before software engineers %and o.er t%eir code to t%e ne2t stage in t%e software
de.elopment cycle0 t%ey usually perform unit tests# T%ese are small automated tests t%at c%ec5 a
particular part of a program suc% as a single function# T%e actual results of t%ese automated tests
are compared to t%e e2pected results# 9nit tests are a powerful way to c%ec5 w%et%er a program
-e%a.es li5e it is designed to -e%a.e at t%e lowest le.el# T%e code co.erage metric indicates %ow
many lines of code or e2ecuta-le -ranc%es in t%e code %a.e -een touc%ed during t%e unit test runs#
- ) -
TIOBE Quality Indicator TIOBE Software
T%e lower t%e co.erage0 t%e lower t%e quality of t%e performed unit tests# >ode co.erage is an
indicator of -ot% /<unctional Suita-ility/ and EFelia-ilityG#
8 simple e2ample of t%e output of a code co.erage tool is s%own for t%e >H code -elow# E.ery line
t%at is coloured EgreenG is touc%ed during at least one of t%e tests0 w%ereas EredG lines are not
touc%ed -y any test#
25: if (
26: element.ElementType == ElementType.Class &&
27: element.Declaration.Name.EndsWit(!Class!"
2#: "
2$: %
&': add(iolation(element) element.Declaration.Name) !Class!"*
&+: ,
&2: else if (
&&: element.ElementType == ElementType.-tr.ct &&
&/: element.Declaration.Name.EndsWit(!-tr.ct!"
&5: "
&6: %
&7: add(iolation(element) element.Declaration.Name) !-tr.ct!"*
&#: ,
&$: ret.rn tr.e*

T%e output of t%e code co.erage tool s%ows t%at all lines in t%is code sample are co.ered -y $unit'
tests0 e2cept for line )!#
2# Abstract Inter&retation# 8 fairly new tec%nology is to detect possi-le relia-ility issues in software
programs -y running a-stract interpretation tools0 also 5nown as deep flow analysis tools# T%ese
tools are capa-le of automatically detecting all 5inds of programming errors related to t%e control
flow of a program# E2amples are null pointer dereferences0 -uffer o.erflows and unclosed data-ase
connections# T%e ad.antage of t%ese tools is t%at t%ey generate t%eir results wit%out actually
running t%e programs# T%is is done -y calculating all possi-le pat%s t%roug% a program in an
efficient way# Errors found -y a-stract interpretation are se.ere programming errors t%at may result
in cras%es# T%is metric is mapped to t%e /Felia-ility/ attri-ute#
8 simple e2ample of an a-stract interpretation issue is s%own in t%e +a.a code -elow#
+5$: public 0rder 1et0rder(" %
+6': 22 0nly ret.rn orders 3it a 4alid date
+6+: if (orderDate.is(alid("" %
+62: return order*
+6&: , else %
+6/: return null*
+65: ,
+66: ,
5
227: public 6ist70rder8 1et0rder9ac:a1es(" %
22#: return 1et0rder(".1etCorrespondin10rder9ac:a1es(company"*
22$: ,
8-stract interpretation tools will flag a possi-le null pointer dereference at line 22"0 -ecause t%e
function EgetOrderG can return null in case t%e order %as no .alid date# If t%is situation occurs an
e2ception will -e t%rown0 possi-ly resulting in program a-ortion#
)# Cyclomatic com&le-ity# One of t%e oldest software metrics is cyclomatic comple2ity# >yclomatic
- A -
TIOBE Quality Indicator TIOBE Software
comple2ity counts t%e num-er of independent pat%s t%roug% a program# <or instance0 eac% /if/
statement adds one e2tra code pat%# T%e %ig%er t%e cyclomatic comple2ity t%e %arder it is to
understand a program# 1oreo.er0 t%e more pat%s t%ere are0 t%e more test cases need to -e written
to ac%ie.e a decent code co.erage# T%e a.erage cyclomatic comple2ity per function is an indicator
t%at ena-les comparisons of comple2ity -etween programs# It is part of t%e /1aintaina-ility/
attri-ute#
T%e >H code -elow s%ows a simple e2ample of %ow cyclomatic comple2ity is calculated#
+2&: public int 1et(al.e(int param+"
+2/: %
+25: int 4al.e = '*
+26: if (param+ == '"
+27: %
+2#: 4al.e = /*
+2$: ,
+&': else
+&+: %
+&2: 4al.e = '*
+&&: ,
+&/: return 4al.e*
+&5: ,
T%e cyclomatic comple2ity of t%e function EgetIalueG at line 2) is 2 $one pat% t%roug% Et%enG and
one t%roug% EelseG'#
A# Com&iler "arnin's# In order to e2ecute a software program on a computer it first must -e
compiled or interpreted# >ompilers7interpreters generate errors and warnings# Errors must -e fi2ed
ot%erwise t%e program cannot run# =arnings on t%e ot%er %and do not necessarily need to -e
sol.ed# :owe.er0 some compiler warnings indicate serious program flaws# @ea.ing t%ese unresol.ed
%as pro-a-ly impact on t%e /Felia-ility/ of t%e code# 8part from t%is0 most compilers also warn a-out
porta-ility issues# So t%is metric can also mapped to ETransfera-ilityG in most cases#
8 simple e2ample of a compiler warning is s%own in t%e > code -elow#
&+: int f.nc(int i" %
&2: if (i = '" %
&&: return ;+*
&/: ,
...
5#: ,
1ost compilers will complain a-out t%e assignment in t%e if condition at line )2 $pro-a-ly a
comparison was meant instead'#
6# Codin' standards# Software maintenance is one of t%e most time consuming tas5s of software
engineers# One of t%e reasons for t%is is t%at it is %ard to understand t%e intention of program code
long after it %as -een written0 especially if it %as -een updated a lot of times# 8 way to reduce t%e
costs of software maintenance is to introduce a coding standard# 8 coding standard is a set of rules
t%at engineers s%ould follow# T%ese coding rules are a-out 5nown language pitfalls0 code
constructions to a.oid0 -ut also a-out naming con.entions and program layout# Since coding
standards usually contain many different rules t%ey can -e mapped to most quality attri-utes# 1ost
rules concern /1aintaina-ility/ and EFelia-ilityG0 -ut t%ere are also rules a.aila-le for ETransfera-ilityG0
E*erformance EfficiencyG and ESecurityG#
- 6 -
TIOBE Quality Indicator TIOBE Software
8n e2ample of a coding standard .iolation is s%own -elow#
&+: int a<s(int i" %
&2: int res.lt*
&&:
&/: if (i 7 '" %
&5: res.lt = ;i*
&6: goto end*
&7: ,
&#: res.lt = i*
&$: end:
/': return res.lt*
/+: ,
8ny > coding standard will complain a-out t%e goto statement used at line )B# It is considered -ad
practice to use goto statements#
B# Code du&lication# Sometimes0 it is .ery tempting for a software engineer to copy some piece of
code and ma5e some small modifications to it instead of generali&ing functionality# T%e draw-ac5 of
code duplication is t%at if one part of t%e code must -e c%anged for w%ate.er reason $sol.ing a -ug
or adding missing functionality'0 it is .ery li5ely t%at t%e ot%er parts oug%t to -e c%anged as well#
But w%o is to notice; If no-ody does0 code duplication will lead to rewor5 in t%e long term# T%is %as
a negati.e effect on /1aintaina-ility/#
!# Fan out# Software programs are structured in terms of modules or components# T%ese modules and
components EuseG eac% ot%er# T%e fan out metric indicates %ow many different modules are used -y
a certain module# If modules need a lot of ot%er modules to function correctly $%ig% fan out'0 t%ere
is a %ig% interdependency -etween modules0 w%ic% ma5es code less modifia-le# :ence0 fan out is
mapped to t%e /1aintaina-ility/ ISO attri-ute#
8n e2ample of a %ig% fan out is s%own in t%e +a.a code -elow#
+: package com.tio<e.pl.1ins.eclipse.analy=er*
2:
&: import >a4a.io.?0E@ception*
/: import >a4a..til.Aap*
5:
6: import or1.apace.commons.e@ec.Command6ine*
7: import or1.apace.commons.e@ec.Defa.ltE@ec.tor*
#: import or1.apace.commons.e@ec.E@ec.teE@ception*
$: import or1.apace.commons.e@ec.E@ec.teBes.ltCandler*
+': import or1.apace.commons.e@ec.E@ec.teWatcdo1*
++: import or1.apace.commons.e@ec.E@ec.tor*
+2: import or1.apace.commons.e@ec.9.mp-treamCandler*
+&: import or1.apace.commons.e@ec.en4ironment.En4ironmentDtils*
+/: import or1.apace.commons.io.o.tp.t.N.ll0.tp.t-tream*
+5: import or1.eclipse.core.reso.rces.?9ro>ect*
+6: import or1.eclipse.core.reso.rces.?Beso.rce*
+7:
+#: import com.tio<e.pl.1ins.eclipse.console.?T?C-Console*
+$: import com.tio<e.pl.1ins.eclipse.console.T?C-Console*
2': import com.tio<e.pl.1ins.eclipse..til.EclipseDtils*
2+:
22: public class T?C-Enaly=er implements ?T?C-Enaly=er %
- B -
TIOBE Quality Indicator TIOBE Software
In t%is article we %a.e adopted t%e simple definition of fan out to measure t%e num-er of import
statements# :ence0 t%e fan out of t%e +a.a file a-o.e is B#
"# Dead code# If requirements c%ange0 some programming code mig%t -ecome o-solete# Cue to time
pressure0 lac5 of rigorous maintenance or e.en (ust ignorance0 suc% dead code mig%t linger in
software arc%i.es for years# T%e draw-ac5 of dead code is t%at it consumes unnecessary
maintenance effort# Femo.ing dead code increases /1aintaina-ility/#
8n e2ample of dead code is gi.en in t%e following > code#
&+#: int calc.lateinde@(unsigned int i" %
&+$: if (i 7 '" %
&2': return 0*
&2+: , else %
&22: return i*
&2&: ,
&2/: ,

T%e code at line )20 is ne.er e2ecuted -ecause unsigned integers can ne.er -e less t%an 0#
( $easurin' and )ud'in' $etric Values
T%is section defines %ow t%e " metrics of t%e pre.ious section are measured# It also specifies %ow t%e
o-tained metric .alues are to -e (udged on a scale -etween 0 and 00 $called t%e score'# T%e formulas t%at
are used to calculate t%e scores for metrics %a.e -een determined empirically0 -ased on analy&ing t%e more
t%an 200 million lines of code t%at are c%ec5ed -y TIOBE Software eac% day#
If one of t%e metrics is not measured at all for w%ate.er reason0 t%e score for t%is metric is 0#
T%ere are B different categories distinguis%ed -ased on t%e normati.e system# T%ese are similar to t%e
European 9nion energy la-els 304# See t%e ta-le -elow#
Cate'ory 1ame !core
Outstanding J D0
Kood J "0
<airly Kood J !0
1oderate J 60
=ea5 J A0
*oor LM A0
T%e category E1oderateG is a -it larger t%an t%e ot%er categories to create a Kaussian-li5e distri-ution#
T%e " metrics are measured and .alued in t%e following way#
# Code co/era'e# >ode co.erage is measured -y ta5ing t%e a.erage of t%e a.aila-le decision0 -ranc%
and statement co.erage figures# 8t least one of t%ese t%ree co.erage types s%ould -e a.aila-le# T%is
is -ased on researc% done -y Ste.e >ornett 34# T%e following formula is applied to .alue code
co.erage:
- ! -
A
B
C
D
E
F
TIOBE Quality Indicator TIOBE Software
score 2 min34.*( 5 test6co/era'e 7 #.(8 1449
T%e definition of t%e code co.erage score is -ased on t%e fact t%at a code co.erage a-o.e D0N is
perfect $score M 00'# Impro.ing t%e code co.erage if it is a-o.e D0N is not wort%w%ile# On t%e
ot%er %and0 if t%e code co.erage is a-o.e 0N0 i#e# if at least some tests are performed0 t%e score
s%ould -e in category E $score M A0'# Between A0 and 000 t%e score is e.enly distri-uted#
8ccording to t%is formula t%e mapping to t%e code quality categories is as follows#
Code Co/era'e !core Cate'ory
J !B#!N J D0
J B)#)N J "0
J 60N J !0
J 2)#)N J 60
J 0N J A0
LM 0N LM A0
Ta-le : >ode >o.erage Scores
2# Abstract Inter&retation# 8-stract interpretation results are measured -y ta5ing all errors found -y
t%e a-stract interpreter# T%e resulting set of errors is mapped to a scale -etween 0N and 00N .ia
t%e TIOBE compliance factor definition 324# T%e following formula is applied to t%e compliance
factor to get t%e scores for a-stract interpretation#
score 2 ma-3com&liance6factor3abstract6inter&retation6/iolations9 5 : 1448 49
8-stract interpretation errors are considered to -e important0 so its perfect score $score M 00'
means t%ere are no a-stract interpretation errors at all# 8 compliance less t%an !0N indicates t%at
t%ere are lots of suc% errors0 t%us %a.ing a poor score $score M A0'# T%e score is distri-uted e.enly#
8ccording to t%is formula t%e mapping to t%e code quality categories is as follows#
Com&liance Factor !core Cate'ory
J D6N J D0
J D0N J "0
J "6N J !0
J !6N J 60
J !0N J A0
LM !0N LM A0
Ta-le 2: 8-stract Interpretation Scores
)# Cyclomatic com&le-ity# T%e definition of cyclomatic comple2ity %as -een gi.en -y 1c>a-e 3)4#
T%is definition is also used in t%is article# T%e a.erage cyclomatic comple2ity per function is mapped
on a normati.e scale -y using t%e formula
score 2 min3ma-31%4 : 4 5 cyclomatic6com&le-ity8 498 1449
T%e definition of t%e cyclomatic comple2ity score is -ased on t%e fact t%at an a.erage comple2ity of
- " -
A
B
C
D
E
F
A
B
C
D
E
F
TIOBE Quality Indicator TIOBE Software
less t%an ) is considered to -e good0 and an a.erage comple2ity of more t%an 6 is .ery -ad# T%e
a.erage cyclomatic comple2ity of more t%an 200 million lines of industrial software code as c%ec5ed
-y TIOBE is 2#D!#
8ccording to t%is formula t%e mapping to t%e code quality categories is as follows#
Cyclomatic Com&le-ity !core Cate'ory
L 2#6 J D0
L ) J "0
L )#6 J !0
L A#6 J 60
L 6 J A0
JM 6 LM A0
Ta-le ): >yclomatic >omple2ity Scores
A# Com&iler "arnin's. >ompiler warnings are measured -y running t%e compiler used at t%e %ig%est
possi-le warning le.el# If more t%an one compiler is used $e#g# -ecause code is generated for
multiple platforms'0 t%e warnings of all compilers are com-ined# Since different compilers c%ec5 for
different compiler warnings0 it is not sufficient to use t%e num-er of compiler warnings as input for
t%e score# :ence0 t%e set of compiler warnings s%ould -e normali&ed0 -ased on t%e num-er of
different c%ec5s a compiler performs and t%e se.erity of t%ese c%ec5s# TIOBE uses its compliance
factor for t%is 3240 w%ic% is a figure -etween 0 $no compliance' and 00 $complete compliance0 i#e#
no compiler warnings'# 8 -rief summary of t%e way t%e TIOBE compliance factor is calculated is
gi.en in t%e ne2t section#
Once t%e compliance factor is 5nown0 t%e following formula is applied to determine t%e score for
compiler warnings:
score 2 min3ma-3:1 5 lo'143144 ; com&liance6factor3com&iler6"arnin's99 7
(8 498 1449
T%is rat%er comple2 formula is -ased on t%e o-ser.ation t%at most compilers %a.e lots of different
warnings and most of t%ese warnings donOt occur in t%e software# :ence0 t%e compliance will -e
%ig% most of t%e cases# T%e perfect score $score M 00' is a compliance of at least DD#DDDDN0
w%ereas a compliance lower t%an D0N is considered poor $score M A0'# T%e score is distri-uted
logarit%mically#
8ccording to t%is formula t%e mapping to t%e code quality categories is as follows#
Com&liance Factor !core Cate'ory
J DD#DDD)N J D0N
J DD#DD6AN J "0N
J DD#DB"AN J !0N
J D"#6)22N J 60N
J D0#0000N J A0N
LM D0#0000N LM A0N
Ta-le A: >ompiler =arning Scores
- D -
A
B
C
D
E
F
A
B
C
D
E
F
TIOBE Quality Indicator TIOBE Software
6# Codin' standards# It is important to ma5e sure t%at as many coding standard rules as possi-le are
automated -y code c%ec5ers# <or t%is metric only automated rules are ta5en into account# It is
assumed t%at t%e coding rules %a.e -een categori&ed in se.erity le.els# T%e resulting set of coding
rule .iolations is mapped to a scale -etween 0 and 00 .ia t%e TIOBE compliance factor definition
324# >oding standards are mapped on a normati.e scale -y using t%e formula
score 2 com&liance6factor3codin'6standard6/iolations9
Com&liance Factor !core Cate'ory
J D0N J D0
J "0N J "0
J !0N J !0
J 60N J 60
J A0N J A0
LM A0N LM A0
Ta-le 6: >oding Standard Scores
B# Code du&lication# T%is metric is calculated -y counting t%e num-er of semantically equi.alent
c%ains of 00 to5ens $default for most tools'# T%e total num-er of lines of code t%at contains a c%ain
is ta5en and e2pressed as a percentage of t%e total si&e of t%e system# >ode duplication is mapped
on a normati.e scale -y using t%e formula
score 2 min3:4 5 lo'143code6du&lication9 7 +48 1449
8ccording to t%is formula t%e mapping to t%e code quality categories is as follows#
Code Du&lication !core Cate'ory
L 0#0)N J D0
L 0#0N J "0
L 0#)2N J !0
L )#BN J 60
L 0#00N J A0
JM 0#00N LM A0
Ta-le B: >ode Cuplication Scores
!# Fan out# T%e fan out is measured -y counting t%e a.erage num-er of imports per module# T%is
measurement is language dependent# <or > and >PP t%e num-er of include statements is used0
for +a.a t%e num-er of import statements# =ild cards in +a.a import statements and using
statements in >H in general appear to -e difficult -ecause t%ese statements import se.eral modules
at once# T%at is w%y we c%oose to count t%ese statements as 6# T%e a.erage fan out of a software
system is mapped on a normati.e scale -y using t%e formula

score 2 min3ma-314 : ( 5 fan6out8 498 1449
8ccording to t%is formula t%e mapping to t%e code quality categories is as follows#
- 0 -
A
B
C
D
E
F
A
B
C
D
E
F
TIOBE Quality Indicator TIOBE Software
Fan Out !core Cate'ory
L B J D0
L " J "0
L 0 J !0
L A J 60
L B J A0
JM B LM A0
Ta-le !: <an Out Scores
"# Dead code# Cead code is simply e2pressed as t%e percentage of code in @O>s t%at is not reac%a-le
.ia any program e2ecution# T%e dead code rate is mapped on a normati.e scale -y using t%e
formula
score 2 ma-33144 : 5 dead6code98 49
8ccording to t%is formula t%e mapping to t%e code quality categories is as follows#
Dead Code !core Cate'ory
L 6N J D0
L 0N J "0
L 6N J !0
L 26N J 60
L )0N J A0
JM )0N LM A0
Ta-le ": Cead >ode Scores
+ TIOBE Com&liance Factor
T%ree of t%e eig%t metrics of t%e code quality system in t%is article use t%e TIOBE compliance factor to
e2press compliance to a set of rules# In t%is section0 t%e TIOBE compliance factor is e2plained in more detail#
Its mat%ematical definition can -e found in 3240 w%ere it is 5nown as t%e TIOBE confidence factor#
Basically0 t%e TIOBE compliance factor e2presses %ow muc% code complies to a certain set of rules# T%is
could -e a set of compiler warnings or a set of coding standard rules# T%is is needed -ecause t%e num-er of
compiler warnings or coding standard .iolations in itself doesnOt say anyt%ing a-out code quality# If t%ere are
)0000 compiler warnings left in your code is t%at all rig%t or plain wrong;
T%ere are .arious parameters t%at play a role in mapping t%e num-er of warnings7.iolations to a num-er
-etween 0 and 00 in a sensi-le way# T%ese are:
Total num-er of distinct c%ec5s7rules measured# If your compiler only measures one 5ind of c%ec50
t%e num-er of compiler warnings will usually -e lower if compared to a compiler t%at measures
%undreds of different c%ec5s#
Se.erity le.el of t%ese c%ec5s7rules# >ompiler warnings t%at indicate programming errors s%ould -e
- -
A
B
C
D
E
F
A
B
C
D
E
F
TIOBE Quality Indicator TIOBE Software
weig%ed as more important t%an compiler warnings t%at identify minor issues#
Si&e of t%e software system# T%e larger a software system0 t%e %ig%er t%e c%ances to %a.e more
warnings7.iolations#
T%e lines of code t%at could -e c%ec5ed# If only %alf of your code can -e compiled0 t%en t%e num-er
of compiler warnings $not compiler errors' will -e lower if compared to a situation in w%ic% all code
could -e compiled and c%ec5ed#
8ll t%ese parameters are ta5en into account -y t%e TIOBE compliance factor# Its definition is:
TIOBE Com&liance Factor 2 0ercenta'e of code chec<ed 5 =ei'hted "arnin's

So if only 20N of t%e code could -e c%ec5ed0 t%e TIOBE compliance factor will ne.er e2ceed 20N# 8
weig%ted warning is calculated -y di.iding t%e num-er of warnings of a specific 5ind -y t%e total p%ysical
lines of code $warning density' and t%e num-er of rules for t%e se.erity le.el of t%e 5ind of compiler
warning7coding rule# T%en we di.ide -y A to t%e power of its se.erity le.el# <or instance0 a compiler warning
of le.el ) is considered B times less important t%an a compiler warning of le.el #
* TIOBE Quality Indicator
T%e " code quality metrics defined in t%is article all %elp to get a complete picture of t%e code quality -efore
release# :owe.er0 not all code quality metrics are equally important# <or instance0 a low code co.erage %as
muc% more impact on quality t%an a %ig% dead code rate# T%is section defines %ow t%e " metrics are
com-ined into one o.erall code quality figure0 called t%e TIOBE Quality Indicator $TQI'#
T%e metrics are com-ined -y weig%ing t%em# T%is is -ased on empirical e.idence# It is important to note
t%at TIOBE %as started researc% to correlate software defects to code quality metrics for t%e more t%an 200
million lines of code it measures eac% day# Once t%is researc% %as -een finis%ed0 t%e weig%ing will -e more
solidly founded on statistical data#
T%e " metrics are weig%ted as follows#
$etric =ei'ht
>ode >o.erage 20N
8-stract Interpretation 20N
>yclomatic >omple2ity 6N
>ompiler =arnings 6N
>oding Standards 0N
>ode Cuplication 0N
<an Out 6N
Cead >ode Cetection 6N
*.1 !co&e
Qot all code is su-(ect to t%e TQI# T%e following 5inds of code is e2cluded:
Kenerated code
E2ternal7t%ird party code
Test code
- 2 -
TIOBE Quality Indicator TIOBE Software
, Conclusions
T%e TIOBE Quality Indicator $TQI' is a pragmatic way to get an o.er.iew of t%e quality of software code
-efore release or e.en -efore system testing# T%e indicator com-ines t%e most well-5nown code quality
metrics -y defining %ow t%ey are measured and %ow t%e outcome of t%e resulting measurements s%ould -e
(udged# Based on t%is a software system is la-elled -etween 8 $outstanding quality' and < $poor quality'#
A&&endi- A .eferences
34 Boe%m0 Barry =#R *%ilip Q# *apaccio0 E9nderstanding and >ontrolling Software >ostsG0 IEEE Transactions
on Software Engineering0 .# A0 no# 00 Octo-er D""0 pp# AB2-A!!#
324 ISO0 ESystems and software engineering S Systems and software Quality Fequirements and E.aluation
$SquaFE' S System and software quality modelsG0 ISO7IE> 2600:200 200 o-taina-le from
%ttp:77www#iso#org7iso7isoTcatalogue7catalogueTtc7catalogueTdetail#%tm;csnum-erM)6!))#
3)4 =i5ipedia0 E>yclomatic >omple2ityG0 e2tracted +uly 2020 o-taina-le from
%ttp:77en#wi5ipedia#org7wi5i7>yclomaticTcomple2ity#
3A4 =i5ipedia0 ECuplicated >odeG0 e2tracted +uly 2020 o-taina-le from
%ttp:77en#wi5ipedia#org7wi5i7CuplicateTcode#
364 =i5ipedia0 E>ode >o.erageG0 e2tracted +uly 2020 o-taina-le from
%ttp:77en#wi5ipedia#org7wi5i7>odeTco.erage#
3B4 =i5ipedia0 E8-stract InterpretationG0 e2tracted +uly 2020 o-taina-le from
%ttp:77en#wi5ipedia#org7wi5i78-stractTinterpretation#
3!4 =i5ipedia0 E>oding >on.entionsG0 e2tracted +uly 2020 o-taina-le from
%ttp:77en#wi5ipedia#org7wi5i7>odingTstandard#
3"4 :enry0 S#R Uafura0 C#0 ESoftware Structure 1etrics Based on Information <lowG0 IEEE Transactions on
Software Engineering Iolume SE-!0 Issue 60 Septem-er D"0 pp# 60S6"#
3D4 =i5ipedia0 ECead >odeG0 e2tracted +uly 2020 o-taina-le from %ttp:77en#wi5ipedia#org7wi5i7CeadTcode#
304 =i5ipedia0 EEuropean 9nion energy la-elG0 e2tracted +uly 2020 o-taina-le from
%ttp:77en#wi5ipedia#org7wi5i7EuropeanT9nionTenergyTla-el#
34 >ornett0 Ste.e0 E>ode >o.erage 8nalysisG0 o-taina-le from %ttp:77www#-ullseye#com7co.erage#%tml#
324 +ansen0 *aulR Uri5%aar0 FeneR Ci(5stra0 <ons0 ETowards a Single Software Quality 1etric S T%e Static
>onfidence <actorG0 200B0 o-taina-le from
%ttp:77www#tio-e#com7content7paperinfo7CefinitionOf>onfidence<actor#%tml#
3)4 1c>a-e0 T%omas +#0 E8 >omple2ity 1easureG0 IEEE Transactions on Software Engineering Iolume SE-20
Issue A0 Cecem-er D!B0 pp# )0"S)20#
A&&endi- B .e/ie"ers
T%e following persons %a.e re.iewed t%is document#
1ame Com&any
+o%an .an Beers *%ilips :ealt%care
Fo- Koud TIOBE Software
Fene .an :ees T%ales
- ) -
TIOBE Quality Indicator TIOBE Software
Qicolas de +ong TIOBE Software
1arco @ouwerse OcV Tec%nologies
+an .an Qunen TIOBE Software
Ben Oot(ers 9nisys
Cennie Feniers TIOBE Software
Ben .an Fens OcV Tec%nologies
Bram Stappers TIOBE Software
=alfried Ieldman 8S1@
- A -

Você também pode gostar