4. 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
5. 30.000ft and ground level
http://opensimulator.org/wiki/Grid_Architecture_Diagram
pg
5
6. 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
7. Metrics
• lines of code
• method length
• class size
• cyclomatic complexity
• weighted methods per class
• coupling between (object) classes
ckjm
7
http://www.campwoodsw.com/sourcemonitor.html
8. More metrics
• duplication
• check-in counts
• coverage
• testability
• test/code ratio
simian
8
http://www.redhillconsulting.com.au/products/simian/
9. Metrics tree maps
Shows distribution of metrics
Created with checkstyle and InfoVis
9
http://erik.doernenburg.com/2010/05/metrics-tree-maps/
10. 0.0
5.0
10.0
15.0
20.0
25.0
30.0
35.0
40.0
SessionFactory Utils.java
AbstractBeanFactory .java
BeanWrapperImpl.jav a
DispatcherServ let.java
SchedulerFactory Bean.java
AntPathMatcher.jav a
SQLErrorCodeSQLExceptionTranslator.jav a
HibernateTemplate.jav a
ReloadableResourceBundleMessageSource.jav a
PropertiesBeanDef initionReader.jav a
StatementCreatorUtils.java
Lazy ConnectionDataSourceProxy .java
BooleanExpressionComplexity
Def aultMessageListenerContainer.java
JdoTransactionManager.jav a
TopLinkTransactionManager.jav a
ScriptFactory PostProcessor.java
TransactionAwareConnectionFactory Proxy.java
NumberUtils.jav a
HibernateAccessor.jav a
SpringSessionSy nchronization.jav a
BeanDef initionValueResolv er.java
ExtendedEntity ManagerCreator.jav a
ParameterMethodNameResolv er.java
CallableStatementCreatorFactory.java
BeanFactory AspectJAdvisorsBuilder.java
CustomizableTraceInterceptor.jav a
AbstractXsltView.jav a
GenericCollectionTy peResolv er.java
ArgumentConv ertingMethodInv oker.java
SharedEntity ManagerCreator.jav a
FreeMarkerConf igurationFactory.java
SelectedValueComparator.jav a
ClassDataAbstractionCoupling ClassFanOutComplexity
MockHttpServ letRequest.java
FrameworkPortlet.jav a
ResourceArray Property Editor.java
AspectJWeav erMessageHandler.java
MethodMapTransactionAttributeSource.jav a
SingleConnectionFactory .java
MessageListenerAdapter.jav a
JdoTemplate.jav a
CyclomaticComplexity
DataSourceUtils.java
Velocity View.jav a
Toxicity chart
AbstractMessageListenerContainer.java
SqlLobValue.jav a
FileLength
PortletRequestHandledEv ent.java
JdbcOperations.jav a
TxAdv iceBeanDef initionParser.java
ArgTy pePreparedStatementSetter.jav a
Ref reshablePagedListHolder.java
AbstractJasperReportsSingleFormatView.java
MethodLength
ClassUtils.java
SimpleMailMessage.jav a
JmsTransactionManager.jav a
TransactionAttributeEditor.jav a
Def aultBeanDef initionDocumentReader.java
NestedIfDepth
AbstractInterceptorDrivenBeanDefinitionDecorator.java
ResultSetWrappingSqlRowSet.jav a
HsqlMaxValueIncrementer.jav a
CodebaseAwareObjectInputStream.jav a
AbstractSingletonProxy FactoryBean.java
LocalSlsbInv okerInterceptor.java
BeansDtdResolv er.java
AnonInnerLength
AbstractMessageSource.jav a
AbstractDependency InjectionSpringContextTests.java
TomcatInstrumentableClassLoader.java
LocalContainerEntity ManagerFactoryBean.java
ResourceEntity Resolver.java
http://erik.doernenburg.com/2008/11/how-toxic-is-your-code/
Developed by ThoughtWorks using Excel RedirectView.jav a
HtmlCharacterEntityReferences.java
AbstractPathMapHandlerMapping.jav a
AspectJPrecedenceComparator.java
ResourceServ let.java
Adv isedSupport.jav a
EhCacheFactory Bean.java
CustomCollectionEditor.java
CommonsMultipartFile.jav a
Provides easy to compare overview of quality
OpenEntity ManagerInViewFilter.jav a
TopLinkInterceptor.jav a
MethodInv okingJobDetailFactoryBean.java
Def aultNamespaceHandlerResolver.java
XmlValidationModeDetector.jav a
GenericFilterBean.jav a
ParameterNumber MissingSwitchDefault TreeWalker
HessianServ iceExporter.java
Property AccessorUtils.java
InstantiationModelAwarePointcutAdv isorImpl.java
10
11. Size & complexity pyramid
5.75 NOP 224
6.13 NOC 1289
5.69 NOM 7905 7905 NOM 2.79
0.26 LOC 44988 22039 CALLS 0.40
CYCLO 11602 8798 FANOUT
Developed at Universities of Berne and Lugano
Shows key metrics and their relationships
Allows comparison to “industry standards”
Created by iPlasma tool from source code
11
http://loose.upt.ro/iplasma/
http://www.intooitus.com/inFusion.html
12. 0.80
1.00
1.20
1.40
1.60
1/4/06
15/4/06
29/4/06
1
13/5/06
27/5/06
10/6/06
2
24/6/06
8/7/06
22/7/06
5/8/06
19/8/06
2/9/06
3
16/9/06
30/9/06
14/10/06
28/10/06
3
3.05.1
11/11/06
Releases
25/11/06
9/12/06
23/12/06
4
6/1/07
5
Created with Unix tools and Excel
20/1/07
3/2/07
Test to code ratio
6
Unit test LOC/LOC
17/2/07
Shows the test to code ratio over time 3/3/07
7
17/3/07
31/3/07
Lines of unit test code per line of production code
8 9
14/4/07
10
28/4/07
12/5/07
26/5/07
11 12 13
9/6/07
14
23/6/07
15
7/7/07
16
21/7/07
17
4/8/07
18/8/07
12
13. System complexity view
Part of Moose Technology
Polymetric view of class hierarchy
13
http://www.moosetechnology.org/
http://www.inf.usi.ch/faculty/lanza/codecrawler.html
http://sourceforge.net/projects/java2cdif/
14. CodeCity
Also part of Moose Technology
Polymetric views in 3D and more
14
http://www.inf.usi.ch/phd/wettel/codecity-download.html
http://erik.doernenburg.com/2009/07/moose-mse-for-java-and-cs/
16. Dependency Structure Matrix
Not metrics based
Looks at “complex complexity”
16
http://erik.doernenburg.com/2010/04/dependency-structure-matrix/
17. Test coverage
Not as a percentage, shows call graph
AspectJ + GraphViz
17
http://erik.doernenburg.com/2008/09/call-graph-visualisation-with-aspectj-and-dot/
18. DIY
1. 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
19. How do you see quality?
Comparisons
• industry standards
• different revisions: trends
• different parts: outliers
Aesthetics
• symmetry
• balance/harmony
19
20. What next?
Measure
• tech debt
• effectiveness of training
Guide
• refactoring
• clean-up
Celebrate
20