microsoft / Win2D-Samples
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 935 units with 22,334 lines of code in units (77.2% of code).
    • 3 very long units (10,732 lines of code)
    • 18 long units (1,104 lines of code)
    • 132 medium size units (3,986 lines of code)
    • 231 small units (3,279 lines of code)
    • 551 very small units (3,233 lines of code)
48% | 4% | 17% | 14% | 14%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs48% | 4% | 17% | 14% | 14%
cpp0% | 28% | 26% | 11% | 34%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ExampleGallery53% | 4% | 16% | 12% | 12%
ExampleGallery/Direct3DInterop0% | 28% | 26% | 11% | 34%
ExampleGallery/Infrastructure0% | 5% | 35% | 30% | 28%
ExampleGallery/Effects0% | 27% | 30% | 17% | 23%
CoreWindowExample0% | 0% | 34% | 31% | 33%
CompositionExample0% | 0% | 45% | 18% | 36%
ExampleGallery/BackgroundTask0% | 0% | 29% | 47% | 23%
ExampleGallery/Particles0% | 0% | 11% | 56% | 32%
ExampleGallery/SpriteSheets0% | 0% | 0% | 0% | 100%
SimpleSample0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void DrawScene1()
in ExampleGallery/VectorArtScene1.cs
6332 4 1
void DrawScene0()
in ExampleGallery/VectorArtScene0.cs
4262 1 0
private void CreateEffect()
in ExampleGallery/EffectsExample.xaml.cs
138 43 1
private ICanvasImage CreateLighting()
in ExampleGallery/EffectsExample.xaml.cs
82 2 0
void EnsureResources()
in ExampleGallery/SubscriptSuperscript.xaml.cs
76 14 2
public void DrawGlyphRun()
in ExampleGallery/TypographyExample.xaml.cs
74 12 13
private void Canvas_Draw()
in ExampleGallery/StrokeStyles.xaml.cs
71 5 2
List CreateGlyphRuns()
in ExampleGallery/CustomTextLayouts.xaml.cs
70 17 3
void canvas_Draw()
in ExampleGallery/EffectRegionMapping.xaml.cs
64 8 2
private ICanvasImage CreateLuminanceToAlpha()
in ExampleGallery/EffectsExample.xaml.cs
64 1 0
private void DrawPage()
in ExampleGallery/PrintingExample.xaml.cs
62 4 4
public void Draw()
in ExampleGallery/AnimatedControlExample.xaml.cs
61 6 4
private void canvasControl_Draw()
in ExampleGallery/SvgExample.xaml.cs
56 10 2
private void Canvas_Draw()
in ExampleGallery/CustomTextLayouts.xaml.cs
55 12 2
virtual void RunScenario()
in ExampleGallery/Direct3DInterop/SpriteBatchPerformance.cpp
55 6 2
void Canvas_Draw()
in ExampleGallery/ArcOptions.xaml.cs
54 9 2
async Task GenerateIcon()
in ExampleGallery/Infrastructure/AppIconGenerator.cs
54 4 3
void CreateEffects()
in ExampleGallery/GameOfLife.xaml.cs
52 1 0
private void Canvas_Draw()
in ExampleGallery/GeometryOperations.xaml.cs
52 5 2
private void CreateFlameEffect()
in ExampleGallery/BurningTextExample.xaml.cs
51 1 0