aws-samples / aws-mlu-explain
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 281 units with 6,565 lines of code in units (7.8% of code).
    • 5 very long units (802 lines of code)
    • 27 long units (1,929 lines of code)
    • 67 medium size units (2,115 lines of code)
    • 82 small units (1,201 lines of code)
    • 100 very small units (518 lines of code)
12% | 29% | 32% | 18% | 7%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js12% | 28% | 32% | 18% | 7%
py0% | 100% | 0% | 0% | 0%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
code/decision-tree17% | 46% | 21% | 12% | 1%
js30% | 0% | 30% | 17% | 21%
code/double-descent237% | 0% | 37% | 23% | 1%
code/bias-variance5% | 33% | 39% | 14% | 7%
code/double-descent0% | 18% | 39% | 31% | 10%
code/parcel-mlu-explain-starter0% | 0% | 19% | 38% | 42%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
drawPackedCircles()
in code/decision-tree/js/EntropyTree.js
271 33 0
function p()
in js/rough-notation.js
194 56 6
entropy: entropy()
in code/decision-tree/js/EntropyBubble.js
116 5 1
drawFigure()
in code/double-descent2/js/DeltaChart.js
113 5 0
positionErrorBarsAsLabels()
in code/bias-variance/js/ErrorBar.js
108 10 0
x: prob()
in code/decision-tree/js/EntropyBubble.js
100 5 1
constructor()
in code/decision-tree/js/EntropyBubble.js
93 7 1
drawEntropyLine()
in code/decision-tree/js/EntropyBubble.js
93 4 0
drawAxes()
in code/double-descent/js/DoubleDescent.js
93 1 0
drawAxes()
in code/double-descent/js/origDoubleDescent.js
87 4 0
plotErrorLines()
in code/bias-variance/js/ErrorBar.js
80 3 2
plotDecompositionBar()
in code/bias-variance/js/ErrorBar.js
80 2 1
drawDoubleDescentLines()
in code/double-descent/js/DoubleDescent.js
79 1 0
drawDepth()
in code/decision-tree/js/PerturbedDecisionTree.js
77 4 1
function updateNodePositions()
in code/decision-tree/js/EntropyBubble.js
76 10 0
function mousemove()
in code/decision-tree/js/InformationGainScatter.js
75 6 1
drawDepth()
in code/decision-tree/js/DecisionTree.js
73 9 1
function mousemove()
in code/decision-tree/js/InformationGainLine.js
72 6 1
plotComplexCircleAll()
in code/bias-variance/js/ErrorBar.js
70 9 0
drawScatter()
in code/decision-tree/js/InformationGainScatter.js
69 1 0