case tools

43
Software Metric Tools Joel Keyser, Jacob Napp, Carey Norslien, Stephen Owings, Tristan Paynter

Upload: dillon

Post on 25-Feb-2016

43 views

Category:

Documents


0 download

DESCRIPTION

CASE Tools. To help with software quality Peter Behl Cody Calhoun Brent Carlovsky Jake Markwardt. Overview. History 3 rd party tools ReSharper Junit Analyst4j Rose C++ Repositories Automatic Code generation. History 1968. Information System Design and Optimization System(ISDOS) - PowerPoint PPT Presentation

TRANSCRIPT

PowerPoint Presentation

Software Metric ToolsJoel Keyser, Jacob Napp, Carey Norslien, Stephen Owings, Tristan Paynter1OverviewToolExample CodeCode AnalyzerLinux KernelJFreeChartJUnitSLF4JSourceMonitorLinux KernelSLF4JJUnitJMetricJUnitMetrics (Eclipse Plugin)JFreeChartSLF4JJUnitUnderstandLinux KernelLibraries3JUnit OverviewLibrary used for creating, running, and sharing details of tests in Java#1 used open source Java libraryList of detailed features at http://junit.org/ 4JFreeChart OverviewLibrary for creating graphs and other charts in Java applications

4.9/5 Stars on SourceForge download page

Easy to work with

Highly extensible

5

6Linux Kernel OverviewOperating system kernel for Linux.Written in C, supported by GCC.A kernel manages input/output requests from software, and translates them into data processing instructions for the central processing unit and other electronic components of a computer (Wikipedia)7SLF4J OverviewSimple Logging Facade for Java User can plug in desired logging framework at deploymentResearch in 2013 sampled 10,000 java projects in GitHub and 30.7% of them used SLF4J.8OpenJDK7 OverviewOpen source implementation of Java Standard EditionOfficially supported by OracleAided by community participation

9Metric Tools10Code Analyzer (Desktop App)

11Code Analyzer OverviewFree softwareSimple to useSupportsC (*.c, *.h)C++ (*.cpp, *.cc, *.h, *.hh)java (*.java)html (*.html, *.htm)Assembly (*.s, *.asm, *.ia)12Code Analyzer MetricsTotal Files (For multiple file metrics)Total LinesCode LinesComment LinesWhitespace LinesAverage Line LengthCode Lines/File (For multiple file metrics)Comment Lines/File (For multiple file metrics)Code/Comments RatioCode/Whitespace RatioCode/(Comments + Whitespace) Ratiohttp://www.codeanalyzer.teel.ws/Carey13Code Analyzer - jUnit

14Code Analyzer - JFreeChart

15Code Analyzer Linux Kernel

16SourceMonitor (Desktop App)

Jacob17SourceMonitor OverviewSimple Software Metrics SystemFreeFully supports most of the common languages (C++, C, C#, VB.NET, Java, and Delphi)Easy to useSomewhat simplisticPerformance issues with large software projects, such as the Linux Kernel.

18SourceMonitor MetricsLOCPercentage of Comments = (Lines w/ Comments) / LOC per classNumber of Branches per classMax + Average depth per classMax + Average Complexity per class

19How Complexity is DeterminedDetermined by the number of execution paths through a function/method.Starts with a base of 1Add 1 for each branch (if, for, while)Add 1 for each && or || in a logical conditionAdd 1 for each exit from code (continue, break, throw, etc...)

20Source Monitor Example Linux Kernel

Entire Linux Kernel

Linux Kernel arch

Linux Kernel block Carey21

22JMetric (Desktop App)

Joel23JMetric OverviewSoftware used to measure and display Object-Oriented metrics of other softwareSpecifically for JavaCan see the data in charts, tables*, or exported text filesCreated in 1998 through the Swinburne University of TechnologyWas last updated in 2000, hence the bugsFails to analyze most filesVarious interface bugs24JMetric MetricsLOC, # variables, # methodsPackage LevelLack of Cohesion of Methods (LCOM)Class LevelCyclomatic Complexity# Parameters# local variables# if statements25Lack of Cohesion of MethodsBHS/CK/default are different ways to measure the same thing: the lack of cohesion per classLow value is good (high cohesion), high value is bad (low cohesion)Calculated by comparing the number of methods that share variables with the number of methods that do notThe point is that, ideally, all variables would be used by all methods26JMetric JUnit Package Analysis

27JMetric JUnit Class Analysis

28Metrics (Eclipse Plugin)

Phtephen29Metrics OverviewAdd-in to EclipseAutomatically calculates on buildFor metrics that are badShows resource most responsibleAllows easy fixingIntegrated directly into IDE30Metrics (Plugin) MetricsCyclomatic ComplexityNested Block DepthSteve31Metrics (Plugin) MetricsAfferent CouplingEfferent CouplingDepth of Inheritance TreeTristan32Metrics - JFreeChart

.equals method = 207 lines of if tests.refreshTicksVertical = 190 lines of nested statements33Metrics - JUnit

34JFreeChart Number of Parameterspublic LegendItem(String label, String description, String toolTipText, String urlText, boolean shapeVisible, Shape shape, boolean shapeFilled, Paint fillPaint, boolean shapeOutlineVisible, Paint outlinePaint, Stroke outlineStroke, boolean lineVisible, Shape line, Stroke lineStroke, Paint linePaint)35Understand

36Understand OverviewStatic Code Analysis ToolAn IDE more concerned about analyzing a software project, rather than developing a software project.Major Product FeaturesCode KnowledgeMetrics & ReportsGraphingStandards TestingDependency AnalysisDoesnt care about good or bad metrics.Supports over a dozen languages, including C/C++/C# and Java.Three price pointsFloating License: $1,995Single Developer License: $995.00Free Two Week Trial37Understand MetricsAround 70 metricsCyclomatic ComplexityMaximum Nesting DepthMaximum Inheritance Tree

38Comparison - Results39Comparison SourceMonitor MetricsLibraryLOC% Comments% Branches/ClassSLF4J26,53846.011.9Linux Kernel*37,60821.219.7JUnit677,05817.45JFreeChart229,49149.614.9OpenJDK73,254,22943.016.1* Due to performance issues, only the block folder was analyzed.40Comparison SourceMonitor MetricsLibraryAvg Depth/ClassAvg Complexity/ClassNumber of FilesSLF4J1.671.66232Linux Kernel*1.533.6975JUnit1.451,226,755**8071JFreeChart1.962.38653OpenJDK72.541,359,640***14,152* Due to performance issues, only the block folder was analyzed.** Two methods were measured with 1,936,482,677 complexity.***Avg complexity varied widely.41Comparison Plugin MetricsLibraryCyclomatic ComplexityNested Block DepthAfferent CouplingEfferent CouplingDepth of Inheritance TreeSLF4J1.461.262.52.751.162Linux Kernel*6.4490385051.160288839--0.00013293

JUnit1.2651.21312.184.5571.361JFreeChart2.271.4335.2811.421.83Open JDK7*2.61.821791.645133* Plugin only supports Java. Understand and Excel were used to obtain similar results. 42ConclusionMetrics tools can be very useful for code analysisMany different types of metrics tool, some open source other commercial

Tristan43