SLIDE 1 Software Quality –
you know it when you see it
Erik Doernenburg ThoughtWorks
SLIDE 2
SLIDE 3 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?
SLIDE 4 30.000ft and ground level
http://opensimulator.org/wiki/Grid_Architecture_Diagram .org/wiki/Image:Grids_Architecture_Diagram.jpg
SLIDE 5
The 1000ft view, literally
CodeCity by Richard Wettel
SLIDE 6
The 1000ft view
Provides information at the right level Aggregates lots of data and multiple metrics Uses visualisation tools and techniques Depends on the question you need answered
SLIDE 7 Metrics
Some established metrics:
- Lines of Code
- Method length
- Class size
- Boolean expression complexity
- Cyclomatic Complexity
ckjm
checkstyle
...
SLIDE 8 Metrics
Some newer metrics:
- Duplication
- Coverage
- Testability
Composed metrics
- coverage against test/code ratio
simian
... cobertura
SLIDE 9 Size & complexity pyramid
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
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
SLIDE 10
Toxicity chart
Developed by ThoughtWorks Provides easy to compare overview of quality Created with checkstyle & Excel from source
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 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 MockHttpServ letRequest.java FrameworkPortlet.jav a ResourceArray Property Editor.java AspectJWeav erMessageHandler.java MethodMapTransactionAttributeSource.jav a SingleConnectionFactory .java MessageListenerAdapter.jav a JdoTemplate.jav a DataSourceUtils.java Velocity View.jav a AbstractMessageListenerContainer.java SqlLobValue.jav a PortletRequestHandledEv ent.java JdbcOperations.jav a TxAdv iceBeanDef initionParser.java ArgTy pePreparedStatementSetter.jav a Ref reshablePagedListHolder.java AbstractJasperReportsSingleFormatView.java ClassUtils.java SimpleMailMessage.jav a JmsTransactionManager.jav a TransactionAttributeEditor.jav a Def aultBeanDef initionDocumentReader.java AbstractInterceptorDrivenBeanDefinitionDecorator.java ResultSetWrappingSqlRowSet.jav a HsqlMaxValueIncrementer.jav a CodebaseAwareObjectInputStream.jav a AbstractSingletonProxy FactoryBean.java LocalSlsbInv okerInterceptor.java BeansDtdResolv er.java AbstractMessageSource.jav a AbstractDependency InjectionSpringContextTests.java TomcatInstrumentableClassLoader.java LocalContainerEntity ManagerFactoryBean.java ResourceEntity Resolver.java 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 OpenEntity ManagerInViewFilter.jav a TopLinkInterceptor.jav a MethodInv okingJobDetailFactoryBean.java Def aultNamespaceHandlerResolver.java XmlValidationModeDetector.jav a GenericFilterBean.jav a HessianServ iceExporter.java Property AccessorUtils.java InstantiationModelAwarePointcutAdv isorImpl.java
BooleanExpressionComplexity ClassDataAbstractionCoupling ClassFanOutComplexity CyclomaticComplexity FileLength MethodLength NestedIfDepth AnonInnerLength ParameterNumber MissingSwitchDefault TreeWalker
SLIDE 11
Codecrawler
Part of a larger academic initiative Allows exploration of quality metrics Reads XMI data
SLIDE 12
Class metrics chart
Takes class as the basic entity and explore highly dimensional properties/metrics Uses Google Docs and Motion Chart gadget
SLIDE 13 Test to code ratio
Shows the test to code ratio over time Created with Unix tools & Excel
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
SLIDE 14 DIY
- 1. Choose tools that calculates the metrics
- Source code analysis easier than bytecode
- 2. Aggregate data
- Ruby scripts, unix tools, etc
- VBA and pivot tables are an option, too
- 3. Choose tool to render graphics from data
- Excel is a powerful graphing tool
- Gnuplot and InfoViz are also useful
SLIDE 15 How do you see quality?
Quality can be subjective and relative Comparisons
- industry standards
- different revisions of same software (trends)
- different parts of same system (outliers)
Aesthetics
SLIDE 16
And then what?
Measure tech debt Measure effectiveness of training / coaching Guide refactoring / cleanup Direct effort Celebrate success
SLIDE 17 Thank you
erik.doernenburg.com www.thoughtworks.com