microsoft / AISchoolTutorials
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 1,795 units with 22,241 lines of code in units (50.3% of code).
    • 11 very long units (1,464 lines of code)
    • 35 long units (2,169 lines of code)
    • 227 medium size units (6,909 lines of code)
    • 372 small units (5,426 lines of code)
    • 1,150 very small units (6,273 lines of code)
6% | 9% | 31% | 24% | 28%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
js12% | 10% | 31% | 21% | 23%
py9% | 6% | 32% | 24% | 25%
cs1% | 9% | 30% | 26% | 31%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sketch2code/Sketch2Code.Web11% | 10% | 31% | 21% | 25%
style-transfer/Training34% | 0% | 25% | 10% | 29%
snipinsights/windows1% | 8% | 29% | 27% | 33%
pix2story/source5% | 8% | 33% | 27% | 25%
MLNETCrashCourse/00.CompleteExamples25% | 35% | 29% | 3% | 5%
sketch2code/Import0% | 100% | 0% | 0% | 0%
sketch2code/Sketch2Code.Core0% | 0% | 55% | 29% | 15%
style-transfer/WebApp0% | 0% | 38% | 43% | 17%
sketch2code/Sketch2Code.Api0% | 0% | 0% | 100% | 0%
sketch2code/Sketch2Code.AI0% | 0% | 0% | 40% | 60%
MLNETCrashCourse/05.LogisticRegression0% | 0% | 0% | 61% | 38%
MLNETCrashCourse/04.PolynomialRegression0% | 0% | 0% | 0% | 100%
MLNETCrashCourse/03.MultipleLinearRegression0% | 0% | 0% | 0% | 100%
MLNETCrashCourse/01.IntroductionToMLNET0% | 0% | 0% | 0% | 100%
MLNETCrashCourse/02.LinearRegression0% | 0% | 0% | 0% | 100%
MLNETCrashCourse/06.SupportVectorMachines0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
function()
in sketch2code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
270 78 0
function()
in sketch2code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
173 63 0
function()
in sketch2code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
164 54 0
function()
in sketch2code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
113 40 0
def main()
in style-transfer/Training/StyleTransferTraining/src/train.py
111 21 0
function()
in sketch2code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
110 28 0
public async Task DeleteAsync()
in snipinsights/windows/SnipInsight/AppManager.cs
110 22 3
function()
in sketch2code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
105 22 0
function()
in sketch2code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
104 28 0
def trainer()
in pix2story/source/skipthoughts_vectors/training/train.py
103 13 2
static void Main()
in MLNETCrashCourse/00.CompleteExamples/05.LogisticRegression/Program.cs
101 2 1
def trainer()
in pix2story/source/skipthoughts_vectors/decoding/train.py
97 12 4
(function (global, factory)()
in sketch2code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
97 15 2
static void Main()
in MLNETCrashCourse/00.CompleteExamples/06.SupportVectorMachines/Program.cs
88 2 1
(function (global, factory)()
in sketch2code/Sketch2Code.Web/Scripts/umd/popper.js
84 10 2
var Tooltip = function()
in sketch2code/Sketch2Code.Web/Scripts/bootstrap.bundle.js
75 1 1
private async Task GetLUISInsights()
in snipinsights/windows/SnipInsight/AIServices/AIViewModels/OCRViewModel.cs
73 21 1
async void Send()
in snipinsights/windows/SnipInsight/Util/LogUploader.cs
70 11 1
void OnShareEmailWithImage()
in snipinsights/windows/SnipInsight/AppManager.cs
64 10 0
private void ProcessShareAction()
in snipinsights/windows/SnipInsight/StateMachine/StateMachine.cs
64 11 1