CSI 29 sept 2012

Preview:

DESCRIPTION

Presented by Smitha Thumbikkat and Milan Chandrahasn, Collabera Solutions at the Best Practices Sharing Event in 2012 conducted by the Computer Society of India held,in Bangalore

Citation preview

1

Smitha T, Milan C

Collabera Solutions

Bangalore

A New Paradigm in Software Quality

3

Fundamental challenge - measurability

Pe

op

le

E n g i n e e r i n g

Genrich Altshuller scanned 400,000 patent descriptions, and found that only 2% were really new. This means, 98% of all new problems can be solved using previous experience/learning(s).

4

5

Industrial Revolution

1913

1955

1976

Requirements structure

Test case adequacy Code

structure

Structural application profile

“. . . .Yo u r h a n d s c a n ’ t

h i t w h a t yo u r e ye s

c a n ’ t s e e … . .”

M u h a m m a d A l i

6

7

Requirements Architecture Design & Coding

Unit Testing System

/Functional Testing

Requirements & Architecture

Baseline Continuous Integration & Iteration Releases

T y p i c a l L i f e c y c l e i n C o l l a b e r a

Can ‘defect prone’ tendency be isolated? 9

Cyclomatic complexity

%Branch Statements

Depth of Inheritance

Calls/method

Methods / Class

Class Coupling

Maintainability Index Boolean Expression

complexity

Class Data Abstraction coupling

Class Fan Out Complexity

Npath Complexity

Java NCSS

% comment Lines Density of comment lines

Public undocumented API

Duplicated lines

Duplicated blocks

Number of children

Afferent couplings

Lack of cohesion methods

Package dependencies to cut

Violations

Complexity distribution by method

Complexity distribution by class

File dependencies to cut

The problem of plenty…

10

II

B r i d g i n g t h e e a g l e ’ s e y e a n d w o r m ’ s v i e w Slide 11

% Branches Block Depth

Cyclomatic Complexity

Correlating SIT with engineering metrics

% Branches Block Depth

Max Cyclomatic Complexity

11

Influence of complexity attribute

Composite parameter analysis

92%

4%

2% 1% 1%

Number of Class vs SIT defects

8% of classes is contributing to 100% of SIT defects

Study from European university

Key parameters measured

Cyclomatic complexity/LOC No. of methods/class No. of Calls/method LOC/method

12

Toxicity Analysis

13

Detailed study of the data shows most of the SIT & AT defects are occurring amongst the top four Java classes shown in the sample data above which have highly toxic code with high method length

Correlates to AT & SIT defects

2.3.10.1

2.3.9.2 2.3.6.2

2.3.53.2

2.3.52.2

2.3.5.2 2.3.4.2 2.3.36.2

2.3.35.2

2.3.34.2

2.3.33.2

2.3.32.2 2.3.30.2 2.3.20.2 2.3.19.2

2.3.10.2

2.3.7.2

2.3.50.2

2.3.49.2

2.3.20.2

2.3.13.2 2.3.44.2 2.3.43.2 2.3.42.2 2.3.41.2

2.3.40.2

2.3.39.2

2.3.38.2

2.3.37.2

2.3.11.2

2.3.12.2

2.3.27.2

2.3.2.2

2.3.1.2

2.3.48.2

2.3.47.2

2.3.46.2

2.3.45.2

2.3.26.2

2.3.25.2

2.3.23.2

2.3.22.2

2.3.18.2

2.3.17.2

2.3.16.2

2.3.15.2

UC complexity v/s cyclomatic complexity

14

See code akin to a city map...

15

Developer’s Structural Analysis Kit

16

Parameters

• Max /Avg. Cyclomatic Complexity

• Methods Per Class

• Avg Statements Per Method

• % Branch statements

• Max Block Depth

• No. of Calls/method

• LOC/method

• Data abstraction coupling

Tools

• Source monitor

• PMD

• Checkstyle

• iPlasma & Code city

• Sonar

Process

• Integration to build tools

• Prior to code review

• Analysis before release

Shifting to the better – Project level

17

Shifting to the better – Org level

18

0

2

4

6

8

10

12

14

16

18

Max CodeComplexity

Methods perClass

Statementper Method

Branches % Max BlockDepth

Dec-10

Dec-11

Improved Pre-SIT Detection

19

Dec-09 Dec-11 Till Date

Shift in defect distribution

Requirements & Design review

Code Review Unit Test System Test Post Release

Pre Post

20

21

Customer Satisfaction

Engagement Planning Engagement Execution Engagement Results People

Overall 20102011

Qualitative Benefits

• Objective measures; language of developer

• Improve ability to isolate and deal with the defective ones

• Improved risk management and transparency

22

Future Study..

• Profiling maintenance enhancements to be defect prone changes upfront

• Profiling application security and performance than just maintainability and functional quality

23