microsoft / WPF-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 3,130 units with 53,756 lines of code in units (42.7% of code).
    • 87 very long units (14,832 lines of code)
    • 106 long units (7,187 lines of code)
    • 414 medium size units (12,442 lines of code)
    • 585 small units (8,724 lines of code)
    • 1,938 very small units (10,571 lines of code)
27% | 13% | 23% | 16% | 19%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs28% | 12% | 22% | 15% | 20%
cpp6% | 25% | 41% | 20% | 6%
h24% | 20% | 18% | 26% | 10%
vb0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
Getting Started92% | 0% | 1% | 2% | 3%
Sample Applications13% | 16% | 33% | 19% | 16%
Tools35% | 14% | 27% | 10% | 12%
Documents16% | 17% | 20% | 17% | 27%
Graphics25% | 20% | 29% | 14% | 9%
Migration and Interoperability32% | 9% | 10% | 19% | 28%
Accessibility18% | 22% | 34% | 9% | 13%
Input and Commands14% | 6% | 14% | 22% | 41%
Visual Layer28% | 0% | 0% | 29% | 42%
Clipboard0% | 32% | 39% | 17% | 10%
Animation0% | 7% | 27% | 33% | 31%
Compatibility0% | 34% | 43% | 17% | 4%
Data Binding0% | 5% | 23% | 24% | 46%
PerMonitorDPI0% | 10% | 27% | 32% | 30%
Windows0% | 0% | 10% | 25% | 63%
Application Management0% | 0% | 16% | 7% | 76%
Styles & Templates0% | 0% | 25% | 18% | 56%
Threading0% | 0% | 19% | 41% | 38%
Drag and Drop0% | 0% | 6% | 43% | 50%
Resources0% | 0% | 38% | 0% | 61%
Elements0% | 0% | 0% | 44% | 55%
Properties0% | 0% | 0% | 20% | 79%
Events0% | 0% | 0% | 26% | 73%
Speech and Media0% | 0% | 0% | 11% | 88%
Globalization and Localization0% | 0% | 0% | 0% | 100%
Element Tree0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
static private void InitializeKnownElements()
in Tools/BamlReflector/BamlTools/KnownElements.cs
766 1 0
public static SolidColorBrush ColorStringToBrushes()
in Documents/Fixed Documents/DocumentSerialization/Util.cs
388 244 1
public void PerformOperation()
in Graphics/Vector/MainWindow.cs
382 35 2
static StaticBamlRecords()
in Tools/BamlReflector/BamlTools/BamlRecords.cs
372 1 0
public void PerformOperation()
in Graphics/Matrix/MainWindow.cs
362 33 2
private void InitializeComponent()
in Migration and Interoperability/WindowsFormsHostingWpfControl/FormsApp/Form1.Designer.cs
314 1 0
public SearchWindow()
in Accessibility/FindText/FindTextClient/SearchWindow.cs
302 2 0
static private void InitializeKnownProperties()
in Tools/BamlReflector/BamlTools/KnownProperties.cs
275 1 0
private static void InitializeHtmlCharacterEntities()
in Sample Applications/HtmlToXamlDemo/HtmlSchema.cs
254 1 0
private static void InitializeHtmlCharacterEntities()
in Documents/Fixed Documents/DocumentSerialization/HtmlXmlConverter/htmlschema.cs
252 1 0
private static void ApplyLocalProperties()
in Sample Applications/HtmlToXamlDemo/HtmlToXamlConverter.cs
218 65 3
private static void ApplyLocalProperties()
in Documents/Fixed Documents/DocumentSerialization/HtmlXmlConverter/htmltoxamlconverter.cs
215 65 3
public void PerformOperation()
in Graphics/Point/MainWindow.cs
214 20 2
void CreateRadioButtons()
in Migration and Interoperability/Win32HostingWPFPage/cpp/win32hostingwpfpage.cpp
210 1 1
private void CreateAndShowMainWindow()
in Graphics/ShapesGallery/app.cs
187 1 0
private void ExecuteCommand()
in Input and Commands/EditingCommands/MainWindow.cs
173 57 2
private void ThirdTabAlarmSettings()
in Sample Applications/StickyNotesDemo/Dialog.cs
163 14 1
internal string CheckAndSetDefault()
in Tools/LocBaml/LocBaml.cs
161 33 0
public void CheckLang()
in Getting Started/Concepts/samps/actualwidth_samp.xaml.cs
150 20 2
public void CheckLang()
in Getting Started/Concepts/samps/animateheight_samp.xaml.cs
150 20 2