ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

21
Lines of unit test code per line of production code 1 2 3 3.05 3.1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 0.80 1.00 1.20 1.40 1.60 1/4/06 15/4/06 29/4/06 13/5/06 27/5/06 10/6/06 24/6/06 8/7/06 22/7/06 5/8/06 19/8/06 2/9/06 16/9/06 30/9/06 14/10/06 28/10/06 11/11/06 25/11/06 9/12/06 23/12/06 6/1/07 20/1/07 3/2/07 17/2/07 3/3/07 17/3/07 31/3/07 14/4/07 28/4/07 12/5/07 26/5/07 9/6/07 23/6/07 7/7/07 21/7/07 4/8/07 18/8/07 Releases Unit test LOC/LOC 0 10 20 30 40 50 60 SessionFactoryUtils AbstractBeanFactory BeanWrapperImpl DispatcherServlet SchedulerFactoryBean AntPathMatcher SQLErrorCodeSQLExceptionTranslator HibernateTemplate ReloadableResourceBundleMessageSource PropertiesBeanDefinitionReader StatementCreatorUtils LazyConnectionDataSourceProxy DefaultMessageListenerContainer JdoTransactionManager TopLinkTransactionManager ScriptFactoryPostProcessor TransactionAwareConnectionFactoryProxy NumberUtils HibernateAccessor SpringSessionSynchronization BeanDefinitionValueResolver ExtendedEntityManagerCreator ParameterMethodNameResolver MBeanClientInterceptor BeanFactoryAspectJAdvisorsBuilder CustomizableTraceInterceptor AbstractXsltView GenericCollectionTypeResolver ArgumentConvertingMethodInvoker SharedEntityManagerCreator FreeMarkerConfigurationFactory OC4JJtaTransactionManager MockHttpServletRequest FrameworkPortlet ResourceArrayPropertyEditor AspectJWeaverMessageHandler MethodMapTransactionAttributeSource SingleConnectionFactory MessageListenerAdapter JdoTemplate FieldRetrievingFactoryBean VelocityView AbstractMessageListenerContainer SqlLobValue PortletRequestHandledEvent JdbcOperations TxAdviceBeanDefinitionParser ConnectorServerFactoryBean RefreshablePagedListHolder SqlMapClientTemplate ClassUtils SystemPropertyUtils JmsTransactionManager DefaultBeanDefinitionDocumentReader TransactionAttributeEditor AbstractInterceptorDrivenBeanDefinitionDecorator ResultSetWrappingSqlRowSet HsqlMaxValueIncrementer AbstractSessionFactory AbstractPropertyAccessor LocalSlsbInvokerInterceptor BeansDtdResolver TransactionAwareDataSourceProxy PersistenceManagerFactoryUtils TomcatInstrumentableClassLoader LocalContainerEntityManagerFactoryBean AopNamespaceUtils JpaInterceptor HtmlCharacterEntityReferences JdoInterceptor CciTemplate AspectJPrecedenceComparator AdvisedSupport OpenEntityManagerInViewFilter ScopedProxyBeanDefinitionDecorator ServletRequestAttributes ReflectiveVisitorHelper BeanDefinitionReaderUtils CustomEditorConfigurer AbstractBeanDefinitionReader ScopedProxyFactoryBean AbstractModelAndViewTests HessianServiceExporter MockPageContext CommonsLoggingLogSystem 0 10 20 30 40 50 60 SessionFactoryUtils AbstractBeanFactory BeanWrapperImpl DispatcherServlet SchedulerFactoryBean AntPathMatcher SQLErrorCodeSQLExceptionTranslator HibernateTemplate ReloadableResourceBundleMessageSource PropertiesBeanDefinitionReader StatementCreatorUtils LazyConnectionDataSourceProxy DefaultMessageListenerContainer JdoTransactionManager TopLinkTransactionManager ScriptFactoryPostProcessor TransactionAwareConnectionFactoryProxy NumberUtils HibernateAccessor SpringSessionSynchronization BeanDefinitionValueResolver ExtendedEntityManagerCreator ParameterMethodNameResolver MBeanClientInterceptor BeanFactoryAspectJAdvisorsBuilder CustomizableTraceInterceptor AbstractXsltView GenericCollectionTypeResolver ArgumentConvertingMethodInvoker SharedEntityManagerCreator FreeMarkerConfigurationFactory OC4JJtaTransactionManager MockHttpServletRequest FrameworkPortlet ResourceArrayPropertyEditor AspectJWeaverMessageHandler MethodMapTransactionAttributeSource SingleConnectionFactory MessageListenerAdapter JdoTemplate FieldRetrievingFactoryBean VelocityView AbstractMessageListenerContainer SqlLobValue PortletRequestHandledEvent JdbcOperations TxAdviceBeanDefinitionParser ConnectorServerFactoryBean RefreshablePagedListHolder SqlMapClientTemplate ClassUtils SystemPropertyUtils JmsTransactionManager DefaultBeanDefinitionDocumentReader TransactionAttributeEditor AbstractInterceptorDrivenBeanDefinitionDecorator ResultSetWrappingSqlRowSet HsqlMaxValueIncrementer AbstractSessionFactory AbstractPropertyAccessor LocalSlsbInvokerInterceptor BeansDtdResolver TransactionAwareDataSourceProxy PersistenceManagerFactoryUtils TomcatInstrumentableClassLoader LocalContainerEntityManagerFactoryBean AopNamespaceUtils JpaInterceptor HtmlCharacterEntityReferences JdoInterceptor CciTemplate AspectJPrecedenceComparator AdvisedSupport OpenEntityManagerInViewFilter ScopedProxyBeanDefinitionDecorator ServletRequestAttributes ReflectiveVisitorHelper BeanDefinitionReaderUtils CustomEditorConfigurer AbstractBeanDefinitionReader ScopedProxyFactoryBean AbstractModelAndViewTests HessianServiceExporter MockPageContext CommonsLoggingLogSystem BooleanExpressionComplexity ClassDataAbstractionCoupling ClassFanOutComplexity CyclomaticComplexity FileLength MethodLength NestedIfDepth AnonInnerLength ParameterNumber MissingSwitchDefault TreeWalker 1

description

 

Transcript of ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

Page 1: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

Lines of unit test code per line of production code

1 2 3 3.053.1 4 5 6 7 8 9 10 11 12 13 14 15 16 17

0.80

1.00

1.20

1.40

1.60

1/4

/06

15/4

/06

29/4

/06

13/5

/06

27/5

/06

10/6

/06

24/6

/06

8/7

/06

22/7

/06

5/8

/06

19/8

/06

2/9

/06

16/9

/06

30/9

/06

14/1

0/0

6

28/1

0/0

6

11/1

1/0

6

25/1

1/0

6

9/1

2/0

6

23/1

2/0

6

6/1

/07

20/1

/07

3/2

/07

17/2

/07

3/3

/07

17/3

/07

31/3

/07

14/4

/07

28/4

/07

12/5

/07

26/5

/07

9/6

/07

23/6

/07

7/7

/07

21/7

/07

4/8

/07

18/8

/07

Releases Unit test LOC/LOC

0

10

20

30

40

50

60

Se

ssio

nF

acto

ryU

tils

Ab

str

actB

ea

nF

acto

ry

Be

an

Wra

pp

erI

mp

l

Dis

pa

tch

erS

erv

let

Sch

ed

ule

rFa

cto

ryB

ea

n

An

tPa

thM

atc

he

r

SQ

LE

rro

rCo

de

SQ

LE

xce

ptio

nT

ran

sla

tor

Hib

ern

ate

Te

mp

late

Re

loa

da

ble

Re

so

urc

eB

un

dle

Me

ssa

ge

So

urc

e

Pro

pe

rtie

sB

ea

nD

efin

itio

nR

ea

de

r

Sta

tem

en

tCre

ato

rUtils

La

zyC

on

ne

ctio

nD

ata

So

urc

eP

roxy

De

fau

ltM

essa

ge

Lis

ten

erC

on

tain

er

Jd

oT

ran

sa

ctio

nM

an

ag

er

To

pL

inkT

ran

sa

ctio

nM

an

ag

er

Scrip

tFa

cto

ryP

ostP

roce

sso

r

Tra

nsa

ctio

nA

wa

reC

on

ne

ctio

nF

acto

ryP

roxy

Nu

mb

erU

tils

Hib

ern

ate

Acce

sso

r

Sp

rin

gS

essio

nS

yn

ch

ron

iza

tio

n

Be

an

De

fin

itio

nV

alu

eR

eso

lve

r

Exte

nd

ed

En

tity

Ma

na

ge

rCre

ato

r

Pa

ram

ete

rMe

tho

dN

am

eR

eso

lve

r

MB

ea

nC

lien

tIn

terc

ep

tor

Be

an

Fa

cto

ryA

sp

ectJ

Ad

vis

ors

Bu

ilde

r

Cu

sto

miz

ab

leT

race

Inte

rce

pto

r

Ab

str

actX

sltV

iew

Ge

ne

ricC

olle

ctio

nT

yp

eR

eso

lve

r

Arg

um

en

tCo

nve

rtin

gM

eth

od

Invo

ke

r

Sh

are

dE

ntity

Ma

na

ge

rCre

ato

r

Fre

eM

ark

erC

on

fig

ura

tio

nF

acto

ry

OC

4JJta

Tra

nsa

ctio

nM

an

ag

er

Mo

ckH

ttp

Se

rvle

tRe

qu

est

Fra

me

wo

rkP

ort

let

Re

so

urc

eA

rra

yP

rop

ert

yE

dito

r

Asp

ectJ

We

ave

rMe

ssa

ge

Ha

nd

ler

Me

tho

dM

ap

Tra

nsa

ctio

nA

ttrib

ute

So

urc

e

Sin

gle

Co

nn

ectio

nF

acto

ry

Me

ssa

ge

Lis

ten

erA

da

pte

r

Jd

oTe

mp

late

Fie

ldR

etr

ievin

gF

acto

ryB

ea

n

Ve

locityV

iew

Ab

str

actM

essa

ge

Lis

ten

erC

on

tain

er

Sq

lLo

bV

alu

e

Po

rtle

tRe

qu

estH

an

dle

dE

ve

nt

Jd

bcO

pe

ratio

ns

TxA

dvic

eB

ea

nD

efin

itio

nP

ars

er

Co

nn

ecto

rSe

rve

rFa

cto

ryB

ea

n

Re

fre

sh

ab

leP

ag

ed

Lis

tHo

lde

r

Sq

lMa

pC

lien

tTe

mp

late

Cla

ssU

tils

Syste

mP

rop

ert

yU

tils

Jm

sT

ran

sa

ctio

nM

an

ag

er

De

fau

ltB

ea

nD

efin

itio

nD

ocu

me

ntR

ea

de

r

Tra

nsa

ctio

nA

ttrib

ute

Ed

ito

r

Ab

str

actI

nte

rce

pto

rDrive

nB

ea

nD

efin

itio

nD

eco

rato

r

Re

su

ltS

etW

rap

pin

gS

qlR

ow

Se

t

Hsq

lMa

xV

alu

eIn

cre

me

nte

r

Ab

str

actS

essio

nF

acto

ry

Ab

str

actP

rop

ert

yA

cce

sso

r

Lo

ca

lSls

bIn

vo

ke

rIn

terc

ep

tor

Be

an

sD

tdR

eso

lve

r

Tra

nsa

ctio

nA

wa

reD

ata

So

urc

eP

roxy

Pe

rsis

ten

ce

Ma

na

ge

rFa

cto

ryU

tils

To

mca

tIn

str

um

en

tab

leC

lassL

oa

de

r

Lo

ca

lCo

nta

ine

rEn

tity

Ma

na

ge

rFa

cto

ryB

ea

n

Ao

pN

am

esp

ace

Utils

Jp

aIn

terc

ep

tor

Htm

lCh

ara

cte

rEn

tity

Re

fere

nce

s

Jd

oIn

terc

ep

tor

CciT

em

pla

te

Asp

ectJ

Pre

ce

de

nce

Co

mp

ara

tor

Ad

vis

ed

Su

pp

ort

Op

en

En

tity

Ma

na

ge

rIn

Vie

wF

ilte

r

Sco

pe

dP

roxyB

ea

nD

efin

itio

nD

eco

rato

r

Se

rvle

tRe

qu

estA

ttrib

ute

s

Re

fle

ctive

Vis

ito

rHe

lpe

r

Be

an

De

fin

itio

nR

ea

de

rUtils

Cu

sto

mE

dito

rCo

nfig

ure

r

Ab

str

actB

ea

nD

efin

itio

nR

ea

de

r

Sco

pe

dP

roxyF

acto

ryB

ea

n

Ab

str

actM

od

elA

nd

Vie

wTe

sts

He

ssia

nS

erv

ice

Exp

ort

er

Mo

ckP

ag

eC

on

text

Co

mm

on

sL

og

gin

gL

og

Syste

m

BooleanExpressionComplexity ClassDataAbstractionCoupling ClassFanOutComplexity CyclomaticComplexity FileLength MethodLength NestedIfDepth AnonInnerLength ParameterNumber MissingSwitchDefault TreeWalker

0

10

20

30

40

50

60

Se

ssio

nF

acto

ryU

tils

Ab

str

actB

ea

nF

acto

ry

Be

an

Wra

pp

erI

mp

l

Dis

pa

tch

erS

erv

let

Sch

ed

ule

rFa

cto

ryB

ea

n

An

tPa

thM

atc

he

r

SQ

LE

rro

rCo

de

SQ

LE

xce

ptio

nT

ran

sla

tor

Hib

ern

ate

Te

mp

late

Re

loa

da

ble

Re

so

urc

eB

un

dle

Me

ssa

ge

So

urc

e

Pro

pe

rtie

sB

ea

nD

efin

itio

nR

ea

de

r

Sta

tem

en

tCre

ato

rUtils

La

zyC

on

ne

ctio

nD

ata

So

urc

eP

roxy

De

fau

ltM

essa

ge

Lis

ten

erC

on

tain

er

Jd

oT

ran

sa

ctio

nM

an

ag

er

To

pL

inkT

ran

sa

ctio

nM

an

ag

er

Scrip

tFa

cto

ryP

ostP

roce

sso

r

Tra

nsa

ctio

nA

wa

reC

on

ne

ctio

nF

acto

ryP

roxy

Nu

mb

erU

tils

Hib

ern

ate

Acce

sso

r

Sp

rin

gS

essio

nS

yn

ch

ron

iza

tio

n

Be

an

De

fin

itio

nV

alu

eR

eso

lve

r

Exte

nd

ed

En

tity

Ma

na

ge

rCre

ato

r

Pa

ram

ete

rMe

tho

dN

am

eR

eso

lve

r

MB

ea

nC

lien

tIn

terc

ep

tor

Be

an

Fa

cto

ryA

sp

ectJ

Ad

vis

ors

Bu

ilde

r

Cu

sto

miz

ab

leT

race

Inte

rce

pto

r

Ab

str

actX

sltV

iew

Ge

ne

ricC

olle

ctio

nT

yp

eR

eso

lve

r

Arg

um

en

tCo

nve

rtin

gM

eth

od

Invo

ke

r

Sh

are

dE

ntity

Ma

na

ge

rCre

ato

r

Fre

eM

ark

erC

on

fig

ura

tio

nF

acto

ry

OC

4JJta

Tra

nsa

ctio

nM

an

ag

er

Mo

ckH

ttp

Se

rvle

tRe

qu

est

Fra

me

wo

rkP

ort

let

Re

so

urc

eA

rra

yP

rop

ert

yE

dito

r

Asp

ectJ

We

ave

rMe

ssa

ge

Ha

nd

ler

Me

tho

dM

ap

Tra

nsa

ctio

nA

ttrib

ute

So

urc

e

Sin

gle

Co

nn

ectio

nF

acto

ry

Me

ssa

ge

Lis

ten

erA

da

pte

r

Jd

oTe

mp

late

Fie

ldR

etr

ievin

gF

acto

ryB

ea

n

Ve

locityV

iew

Ab

str

actM

essa

ge

Lis

ten

erC

on

tain

er

Sq

lLo

bV

alu

e

Po

rtle

tRe

qu

estH

an

dle

dE

ve

nt

Jd

bcO

pe

ratio

ns

TxA

dvic

eB

ea

nD

efin

itio

nP

ars

er

Co

nn

ecto

rSe

rve

rFa

cto

ryB

ea

n

Re

fre

sh

ab

leP

ag

ed

Lis

tHo

lde

r

Sq

lMa

pC

lien

tTe

mp

late

Cla

ssU

tils

Syste

mP

rop

ert

yU

tils

Jm

sT

ran

sa

ctio

nM

an

ag

er

De

fau

ltB

ea

nD

efin

itio

nD

ocu

me

ntR

ea

de

r

Tra

nsa

ctio

nA

ttrib

ute

Ed

ito

r

Ab

str

actI

nte

rce

pto

rDrive

nB

ea

nD

efin

itio

nD

eco

rato

r

Re

su

ltS

etW

rap

pin

gS

qlR

ow

Se

t

Hsq

lMa

xV

alu

eIn

cre

me

nte

r

Ab

str

actS

essio

nF

acto

ry

Ab

str

actP

rop

ert

yA

cce

sso

r

Lo

ca

lSls

bIn

vo

ke

rIn

terc

ep

tor

Be

an

sD

tdR

eso

lve

r

Tra

nsa

ctio

nA

wa

reD

ata

So

urc

eP

roxy

Pe

rsis

ten

ce

Ma

na

ge

rFa

cto

ryU

tils

To

mca

tIn

str

um

en

tab

leC

lassL

oa

de

r

Lo

ca

lCo

nta

ine

rEn

tity

Ma

na

ge

rFa

cto

ryB

ea

n

Ao

pN

am

esp

ace

Utils

Jp

aIn

terc

ep

tor

Htm

lCh

ara

cte

rEn

tity

Re

fere

nce

s

Jd

oIn

terc

ep

tor

CciT

em

pla

te

Asp

ectJ

Pre

ce

de

nce

Co

mp

ara

tor

Ad

vis

ed

Su

pp

ort

Op

en

En

tity

Ma

na

ge

rIn

Vie

wF

ilte

r

Sco

pe

dP

roxyB

ea

nD

efin

itio

nD

eco

rato

r

Se

rvle

tRe

qu

estA

ttrib

ute

s

Re

fle

ctive

Vis

ito

rHe

lpe

r

Be

an

De

fin

itio

nR

ea

de

rUtils

Cu

sto

mE

dito

rCo

nfig

ure

r

Ab

str

actB

ea

nD

efin

itio

nR

ea

de

r

Sco

pe

dP

roxyF

acto

ryB

ea

n

Ab

str

actM

od

elA

nd

Vie

wTe

sts

He

ssia

nS

erv

ice

Exp

ort

er

Mo

ckP

ag

eC

on

text

Co

mm

on

sL

og

gin

gL

og

Syste

m

BooleanExpressionComplexity ClassDataAbstractionCoupling ClassFanOutComplexity CyclomaticComplexity FileLength MethodLength NestedIfDepth AnonInnerLength ParameterNumber MissingSwitchDefault TreeWalker

1

Page 2: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

Software Quality –you know it when you see it

Erik DoernenburgThoughtWorks

@erikdoe // erik.doernenburg.com

2

Page 3: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

3

Page 4: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

Software Quality

External perspective• Is the software of value to its users?

Internal perspective• How appropriate is the design?• How easy is it to understand and extend?• How maintainable is the software?

4

Page 5: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

30.000ft and ground level

http://opensimulator.org/wiki/Grid_Architecture_Diagram

http://opensimulator.org/wiki/Image:Grids_Architecture_Diagram.jpg 5

Page 6: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

The 1000ft view

• Is at the “right” level

• Aggregates data and metrics

• Utilises visualisation techniques

• Makes every pixel count

6

http://97things.oreilly.com/wiki/index.php/Get_the_1000ft_view

Page 7: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

Metrics

• lines of code• method length• class size • cyclomatic complexity• weighted methods per class • coupling between (object) classes

ckjm7

http://www.campwoodsw.com/sourcemonitor.html

Page 8: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

More metrics

• duplication• check-in counts• coverage• testability• test/code ratio

simian

8

http://www.redhillconsulting.com.au/products/simian/

Page 9: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

Metrics tree maps

Shows distribution of metricsCreated with checkstyle and InfoVis

9

http://erik.doernenburg.com/2010/05/metrics-tree-maps/

Page 10: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

Toxicity chart

0.0

5.0

10.0

15.0

20.0

25.0

30.0

35.0

40.0

Sessio

nF

acto

ryU

tils.jav

a

Abstr

actB

eanF

acto

ry.ja

va

BeanW

rapperI

mpl.ja

va

Dis

patc

herS

erv

let.

java

Schedule

rFacto

ryB

ean.java

AntP

ath

Matc

her.

jav

a

SQ

LE

rrorC

odeS

QLE

xceptionTra

nsla

tor.

jav

a

Hib

ern

ate

Tem

pla

te.jav

a

Relo

adable

Resourc

eB

undle

MessageS

ourc

e.jav

a

Pro

pert

iesB

eanD

efi

nitio

nR

eader.

jav

a

Sta

tem

entC

reato

rUtils

.jav

a

Lazy

ConnectionD

ata

Sourc

eP

roxy

.java

Defa

ultM

essageLis

tenerC

onta

iner.

java

JdoTra

nsactionM

anager.

jav

a

TopLin

kTra

nsactionM

anager.

jav

a

ScriptF

acto

ryP

ostP

rocesso

r.ja

va

Tra

nsactionA

ware

ConnectionF

acto

ryP

roxy.jav

a

Num

berU

tils

.jav

a

Hib

ern

ate

Accessor.

jav

a

SpringS

essio

nS

ynchro

niz

ation.jav

a

BeanD

efi

nitio

nV

alu

eR

esolv

er.

java

Exte

ndedE

ntity

ManagerC

reato

r.ja

va

Para

mete

rMeth

odN

am

eR

esolv

er.

java

Calla

ble

Sta

tem

entC

reato

rFacto

ry.jav

a

BeanF

acto

ryA

spectJ

Adv

isors

Build

er.

java

Custo

miz

able

Tra

ceIn

terc

epto

r.ja

va

Abstr

actX

sltV

iew

.jav

a

GenericC

olle

ctionTy

peR

esolv

er.ja

va

Arg

um

entC

onv

ert

ingM

eth

odIn

voker.ja

va

Share

dE

ntity

ManagerC

reato

r.ja

va

Fre

eM

ark

erC

onfi

gura

tionF

acto

ry.java

Sele

cte

dV

alu

eC

om

para

tor.

jav

a

MockH

ttpS

erv

letR

equest.ja

va

Fra

mew

ork

Port

let.

jav

a

Resourc

eA

rray

Pro

pert

yE

ditor.ja

va

AspectJ

Weav

erM

essageH

andle

r.ja

va

Meth

odM

apTra

nsactionA

ttribute

Sourc

e.jav

a

Sin

gle

ConnectionF

acto

ry.java

MessageLis

tenerA

dapte

r.ja

va

JdoTem

pla

te.jav

a

Data

Sourc

eU

tils

.java

Velo

city

Vie

w.jav

a

Abstr

actM

essageLis

tenerC

onta

iner.

java

SqlL

obV

alu

e.jav

a

Port

letR

equestH

andle

dE

vent.

java

JdbcO

pera

tions.jav

a

TxA

dv

iceB

eanD

efi

nitio

nP

ars

er.

java

Arg

Ty

peP

repare

dS

tate

mentS

ett

er.

jav

a

Refr

eshable

PagedLis

tHold

er.

java

Abstr

actJ

asperR

eport

sS

ingle

Form

atV

iew

.java

Cla

ssU

tils

.java

Sim

ple

MailM

essage.jav

a

Jm

sTra

nsactionM

anager.

jav

a

Tra

nsactionA

ttribute

Editor.

jav

a

Defa

ultB

eanD

efi

niti

onD

ocum

entR

eader.

java

Abstr

actI

nte

rcepto

rDrivenB

eanD

efiniti

onD

ecora

tor.ja

va

ResultS

etW

rappin

gS

qlR

ow

Set.

jav

a

HsqlM

axV

alu

eIn

cre

mente

r.ja

va

CodebaseA

ware

Obje

ctI

nputS

tream

.jav

a

Abstr

actS

ingle

tonP

roxy

Facto

ryB

ean.jav

a

LocalS

lsbIn

vokerI

nte

rcepto

r.ja

va

BeansD

tdR

esolv

er.

java

Abstr

actM

essageS

ourc

e.jav

a

Abstr

actD

ependency

Inje

ctio

nS

pringC

onte

xtT

ests

.java

Tom

catI

nstr

um

enta

ble

Cla

ssLoader.

java

LocalC

onta

inerE

ntity

ManagerF

acto

ryB

ean.java

Resourc

eE

ntity

Reso

lver.

java

RedirectV

iew

.jav

a

Htm

lChara

cte

rEntity

Ref

ere

nces.ja

va

Abstr

actP

ath

MapH

andle

rMappin

g.jav

a

AspectJ

Pre

cedenceC

om

para

tor.

java

Resourc

eS

erv

let.

java

Adv

isedS

upport

.jav

a

EhC

acheF

acto

ryB

ean.java

Custo

mC

olle

ctionE

ditor.

java

Com

monsM

ultip

art

File

.jav

a

OpenE

ntity

ManagerI

nV

iew

Filt

er.

jav

a

TopLin

kIn

terc

epto

r.ja

va

Meth

odIn

vokin

gJobD

eta

ilFacto

ryB

ean.java

Defa

ultN

am

espaceH

andle

rReso

lver.

java

Xm

lValid

ationM

odeD

ete

cto

r.ja

va

GenericF

ilterB

ean.jav

a

Hessia

nS

erv

iceE

xport

er.

java

Pro

pert

yA

ccessorU

tils

.jav

a

Insta

ntiationM

odelA

ware

Poin

tcutA

dv

isorI

mpl.ja

va

BooleanExpressionComplexity ClassDataAbstractionCoupling ClassFanOutComplexity CyclomaticComplexity FileLength MethodLength NestedIfDepth AnonInnerLength ParameterNumber MissingSwitchDefault TreeWalker

Provides easy to compare overview of qualityDeveloped by ThoughtWorks using Excel

10

http://erik.doernenburg.com/2008/11/how-toxic-is-your-code/

Page 11: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

Size & complexity pyramid

Developed at Universities of Berne and LuganoShows key metrics and their relationshipsAllows comparison to “industry standards”Created by iPlasma tool from source code

5.75 NOP 2246.13 NOC 1289

5.69 NOM 7905 7905 NOM 2.790.26 LOC 44988 22039 CALLS 0.40

CYCLO 11602 8798 FANOUT

11

http://loose.upt.ro/iplasma/http://www.intooitus.com/inFusion.html

Page 12: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

Lines of unit test code per line of production code

1 2 3 3.053.1 4 5 6 7 8 9 10 11 12 13 14 15 16 17

0.80

1.00

1.20

1.40

1.60

1/4

/06

15/4

/06

29/4

/06

13/5

/06

27/5

/06

10/6

/06

24/6

/06

8/7

/06

22/7

/06

5/8

/06

19/8

/06

2/9

/06

16/9

/06

30/9

/06

14/1

0/0

6

28/1

0/0

6

11/1

1/0

6

25/1

1/0

6

9/1

2/0

6

23/1

2/0

6

6/1

/07

20/1

/07

3/2

/07

17/2

/07

3/3

/07

17/3

/07

31/3

/07

14/4

/07

28/4

/07

12/5

/07

26/5

/07

9/6

/07

23/6

/07

7/7

/07

21/7

/07

4/8

/07

18/8

/07

Releases Unit test LOC/LOC

Shows the test to code ratio over timeCreated with Unix tools and Excel

Test to code ratio

12

Page 13: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

System complexity view

Part of Moose TechnologyPolymetric view of class hierarchy

13

http://www.moosetechnology.org/http://www.inf.usi.ch/faculty/lanza/codecrawler.htmlhttp://sourceforge.net/projects/java2cdif/

Page 14: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

CodeCity

Also part of Moose TechnologyPolymetric views in 3D and more

14

http://www.inf.usi.ch/phd/wettel/codecity-download.htmlhttp://erik.doernenburg.com/2009/07/moose-mse-for-java-and-cs/

Page 15: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

CodeCity continued

Might need a license for VisualWorks Smalltalk

15

Page 16: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

Dependency Structure Matrix

Not metrics basedLooks at “complex complexity”

16

http://erik.doernenburg.com/2010/04/dependency-structure-matrix/

Page 17: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

Test coverage

Not as a percentage, shows call graphAspectJ + GraphViz

17

http://erik.doernenburg.com/2008/09/call-graph-visualisation-with-aspectj-and-dot/

Page 18: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

DIY1. Get metrics

• SourceMonitor, checkstyle, text tools, etc• iPlasma, et al

2. Aggregate data• Ruby scripts, unix tools, etc• VBA and pivot tables

3. Render graphics• Excel is a powerful graphing tool• Gnuplot and InfoViz are easy to use

18

Page 19: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

How do you see quality?

Comparisons• industry standards• different revisions: trends• different parts: outliers

Aesthetics• symmetry• balance/harmony

19

Page 20: ErikDoernenburg_SoftwareQualityYouKnowItWhenYouSeeIt

What next?

Measure• tech debt• effectiveness of training

Guide• refactoring• clean-up

Celebrate

20