132
Development By The Numbers

Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

DevelopmentBy The Numbers

Page 2: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 3: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 4: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 5: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 6: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

We Are Going ToMeasure Complexity

Page 7: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Why Should We Care About Complexity?

Page 8: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

- Geer et al.

"The Central Enemy Of Reliability is Complexity"

Page 9: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Complexity And Quality Are Strongly

Related

Page 10: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 11: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Basic Metrics

Page 12: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

CyclomaticComplexity

Page 13: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Cyclomatic Complexity

Number Of "Decision Points"

In A Routine

Page 14: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo($a, $b) { $c = 0; if ($a) { $c = $a; } elseif ($b) { $c = $b; } if ($a && $b) { $c = $a + $b; } return $c;}

Page 15: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo($a, $b) { $c = 0; if ($a) { $c = $a; } elseif ($b) { $c = $b; } if ($a && $b) { $c = $a + $b; } return $c;}

Page 16: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo($a, $b) { $c = 0; if ($a) { $c = $a; } elseif ($b) { $c = $b; } if ($a && $b) { $c = $a + $b; } return $c;}

4

Page 17: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

SimpleRight?

Page 18: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 19: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Cyclomatic Complexity(Single Method)

1 - 4: Low Complexity5 - 7: Moderate Complexity8 - 10: High Complexity11+: Very High Complexity

Page 20: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Cyclomatic Complexity(Average Per Method)

1 - 2: Low Complexity2 - 4: Moderate Complexity4 - 6: High Complexity6+: Very High Complexity

Page 21: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Compare:Average CC per Method

Wordpress: 6.28Drupal 7: 3.02Drupal 8: 2.10Symfony 2: 1.81Zend Framework 2: 2.62 Laravel: 1.79

Page 22: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Cyclomatic Complexity(Average Per Line Of Code)

.01 - .05: Low Complexity

.05 - .10: Moderate Complexity

.10 - .15: High Complexity

.15+: Very High Complexity

Page 23: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Compare:Average CC per LOC

Wordpress: 0.20Drupal 7: 0.04Drupal 8: 0.07Symfony 2: 0.06Zend Framework 2: 0.10 Laravel: 0.07

Page 24: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 25: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-PathComplexity

Page 26: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

Number Of "Unique Paths"

In A Routine

Page 27: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo($a, $b) { $c = 0; if ($a) { $c = $a; } elseif ($b) { $c = $b; } if ($a && $b) { $c = $a + $b; } return $c;}

Page 28: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo($a, $b) { $c = 0; if ($a) { $c = $a; } elseif ($b) { $c = $b; } if ($a && $b) { $c = $a + $b; } return $c;}

Page 29: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo($a, $b) { $c = 0; if ($a) { $c = $a; } elseif ($b) { $c = $b; } if ($a && $b) { $c = $a + $b; } return $c;}

Page 30: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo($a, $b) { $c = 0; if ($a) { $c = $a; } elseif ($b) { $c = $b; } if ($a && $b) { $c = $a + $b; } return $c;}

Page 31: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo($a, $b) { $c = 0; if ($a) { $c = $a; } elseif ($b) { $c = $b; } if ($a && $b) { $c = $a + $b; } return $c;}

Page 32: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo($a, $b) { $c = 0; if ($a) { $c = $a; } elseif ($b) { $c = $b; } if ($a && $b) { $c = $a + $b; } return $c;}

4

Page 33: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

They Are The Same?

Page 34: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Not Generally!

Page 35: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: NPath:

Page 36: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: NPath:

Page 37: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: 4 NPath:

Page 38: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: 4 NPath:

Page 39: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: 4 NPath:

Page 40: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: 4 NPath:

Page 41: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: 4 NPath:

Page 42: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: 4 NPath:

Page 43: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: 4 NPath:

Page 44: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: 4 NPath:

Page 45: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: 4 NPath:

Page 46: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: 4 NPath: 8

Page 47: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

function foo2($a, $b, $c) { $d = 0; if ($a) { $d += $a; } if ($b) { $d += $b; } if ($c) { $d += $c; } return $d;}

CC: 4 NPath: 8 2^(CC-1)

Page 48: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

<16: Low Complexity17-128: Moderate Complexity129-1024: High Complexity1025+: Very High Complexity

Page 49: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 50: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

Minimum Number Of Tests Required To Completely Test

A Routine

Page 51: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 52: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 53: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

entity_load()

CC: N-Path:

Page 54: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

entity_load()

CC: 2 N-Path:

Page 55: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Cyclomatic Complexity

1 - 4: Low Complexity5 - 7: Moderate Complexity8 - 10: High Complexity11+: Very High Complexity

Page 56: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

entity_load()

CC: 2 N-Path: 2

Page 57: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 58: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

drupal_http_request()

CC: N-Path:

Page 59: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 60: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 61: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 62: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 63: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

drupal_http_request()

CC: 41 N-Path:

Page 64: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Cyclomatic Complexity

1 - 4: Low Complexity5 - 7: Moderate Complexity8 - 10: High Complexity11+: Very High Complexity

Page 65: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

drupal_http_request()

CC: 41 N-Path: 25,303,344,960

Page 66: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 67: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

To Completely Testdrupal_http_request()At 1 Line Of Code Per Test

Would Require

2 TerabytesWorth Of Tests

Page 68: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

To Completely Testdrupal_http_request()At 1 Line Of Code Per Test

Would Require

412 DVD's Worth Of Tests

Page 69: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

To Completely Testdrupal_http_request()At 1 Line Of Code Per Test

Would Require

670k DrupalsWorth Of Tests

Page 70: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

And That's Not The Worst One!

Page 71: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 72: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

_date_repeat_rrule_process()

CC: N-Path:

Page 73: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

_date_repeat_rrule_process()

CC: 81 N-Path:

Page 74: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

_date_repeat_rrule_process()

CC: 81 N-Path: 19,781,719,256

Page 75: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

_date_repeat_rrule_process()

CC: 81 N-Path: 19,781,719,256 ,250,000,000,000

Page 76: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

N-Path Complexity

_date_repeat_rrule_process()

CC: 81 N-Path: 19,781,719,256 ,250,000,000,000 ,000,000,000

Page 77: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

To Completely Test_date_repeat_rrule_process()

At 1 Line Of Code Per Test

Would Require

336T 2009'sWorth Of Tests

Page 78: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

To Completely Test_date_repeat_rrule_process()

At 1 Line Of Code Per Test

Would Require1 Greenland Ice Cap of

microSD cardsWorth Of Tests

Page 79: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 80: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

CRAP

Page 81: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 82: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

CRAP(Change Risk Analysis Predictions)

Page 83: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

CC = Cyclomatic Complexity (method)COV = Test Coverage (percent)

CRAP = CC + (CC^2 * (1 - COV)^3)

Page 84: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 85: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

CRAP

Relates ComplexityAnd Test Coverage

Page 86: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

CRAP

Increasing Test Coverage Lowers CRAPDecreasing Complexity Lowers CRAP

Page 87: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

CRAP

A Low Complexity MethodWith No Tests

Is Good

Page 88: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

CRAP

A Low Complexity MethodWith Good Tests

Is Great

Page 89: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

CRAP

A Moderate Complexity MethodWith Good Tests

Is OK

Page 90: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

CRAP

A Moderate Complexity MethodWith No Tests

Is CRAP

Page 91: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

CRAP

< 5: GREAT Code5 - 15: Acceptable Code15-30: Eih... Code30+: CRAPpy Code

Page 92: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 93: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

How Do WeApply These

Metrics?

Page 94: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 95: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 96: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 97: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Sebastian Bergmann

PHPUnitDbUnitPHPLOCPHPCPDPHPCOVhphpa

www.phpqatools.orgwww.jenkins-php.org

Page 98: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PHPLOC

Page 99: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PHPLOC

By Sebastian Bergmann

Page 100: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PHPLOC

By Sebastian Bergmann

Command Line Tool

Page 101: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PHPLOC

By Sebastian Bergmann

Command Line Tool

Summarizes An Entire Codebase

Page 102: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

$ phploc path/to/Drupal7/Directories: 73Files: 180

Lines of Code (LOC): 63347 Cyclomatic Complexity / Lines of Code: 0.04Comment Lines of Code (CLOC): 19321Non-Comment Lines of Code (NCLOC): 44026

Page 103: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Namespaces: 0Interfaces: 1Traits: 0Classes: 38 Abstract: 2 (5.26%) Concrete: 36 (94.74%) Average Class Length (NCLOC): 197

Page 104: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Methods: 433 Scope: Non-Static: 378 (87.30%) Static: 55 (12.70%) Visibility: Public: 255 (58.89%) Non-Public: 178 (41.11%) Average Method Length (NCLOC): 17 Cyclomatic Complexity / Number of Methods: 3.02

Anonymous Functions: 0Functions: 521

Constants: 22 Global constants: 15 Class constants: 7

Page 105: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PDepend

Page 106: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PDepend

By Manuel Pichler(Also German)

Page 107: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PDepend

By Manuel Pichler(Also German)

Like PHPLOC, But Granular

Page 108: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PDepend

By Manuel Pichler(Also German)

Like PHPLOC, But Granular

Lower Level Analysis

Page 109: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 110: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Fanout: Describes Outward Dependencies - Describes Dependence on Other Classes

ANDC: Average Num of Derived Classes - Describes How Much Inheritance Is Used

AHH: Average Hiearchy Height - Describes How Deep Of Inheritance Is Used

Page 111: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PHPMD(Mess Detector)

Page 112: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PHPMD

By Manuel Pichler(German)

Page 113: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PHPMD

By Manuel Pichler(German)

Finds "Messy" Parts Of Code

Page 114: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PHPMD

By Manuel Pichler(German)

Finds "Messy" Parts Of Code

Finds Rule Violations

Page 115: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

PHPMD RulesCodeSize - (CC, NPath, Number of Methods, Size of Methods, etc)

Design - (Eval, Goto, Exit(), Inheritance Depth)

Naming - (Short names, Inconsistent Names)

Unused CodeControversial - (Superglobal Access, Naming Conventions)

Page 116: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 117: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Prevent Complex CodeFrom Even Getting In!

Page 118: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

By ThemselvesUseful

Page 119: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Over Time

Page 120: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Over TimeInvaluable

Page 121: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Drupal 8.x BranchNon-Comment Lines Of Code

Page 122: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Drupal 8.x BranchNumber Of Classes

Page 123: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Drupal 8.x BranchCyclomatic Complexity Per Method

Page 124: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Drupal 8.x BranchCyclomatic Complexity Per Line

Page 125: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Drupal 8.x Branch

Page 126: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 127: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 128: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 129: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

One More ThingTo Keep In Mind

Page 130: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 131: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:
Page 132: Development By The Numbers - Drupal · 2013-05-22 · Compare: Average CC per Method Wordpress: 6.28 Drupal 7: 3.02 Drupal 8: 2.10 Symfony 2: 1.81 Zend Framework 2: 2.62 Laravel:

Anthony Ferrara@ircmaxell

[email protected]@nbcuni.com

blog.ircmaxell.comgithub.com/ircmaxell

youtube.com/ircmaxell