microsoft / calculator
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,951 units with 25,687 lines of code in units (43.2% of code).
    • 16 very long units (2,975 lines of code)
    • 48 long units (3,256 lines of code)
    • 190 medium size units (5,724 lines of code)
    • 465 small units (6,703 lines of code)
    • 1,232 very small units (7,029 lines of code)
11% | 12% | 22% | 26% | 27%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cpp20% | 17% | 23% | 23% | 15%
cs1% | 7% | 23% | 30% | 37%
h0% | 4% | 11% | 23% | 60%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
src/CalcManager22% | 13% | 22% | 27% | 13%
src/CalcViewModel16% | 18% | 21% | 18% | 26%
src/GraphControl7% | 17% | 22% | 26% | 26%
src/Calculator2% | 8% | 22% | 29% | 36%
src/CalculatorUITestFramework0% | 11% | 26% | 35% | 26%
src/CalculatorUITests0% | 0% | 22% | 29% | 47%
src/GraphingImpl0% | 0% | 0% | 100% | 0%
src/GraphingInterfaces0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
void UnitConverterDataLoader::GetUnits()
in src/CalcViewModel/DataLoaders/UnitConverterDataLoader.cpp
587 12 1
void CCalcEngine::ProcessCommandWorker()
in src/CalcManager/CEngine/scicomm.cpp
509 162 1
CalcEngine::Rational CCalcEngine::SciCalcFunctions()
in src/CalcManager/CEngine/scifunc.cpp
210 77 2
void UnitConverterDataLoader::GetConversionData()
in src/CalcViewModel/DataLoaders/UnitConverterDataLoader.cpp
168 3 1
void DeviceResources::CreateWindowSizeDependentResources()
in src/GraphControl/DirectX/DeviceResources.cpp
160 5 0
private void OnAppLaunch()
in src/Calculator/App.xaml.cs
148 24 2
wstring NumberToString()
in src/CalcManager/Ratpack/conv.cpp
145 38 4
CalcEngine::Rational CCalcEngine::DoOperation()
in src/CalcManager/CEngine/scioper.cpp
132 34 3
void StandardCalculatorViewModel::HandleUpdatedOperandData()
in src/CalcViewModel/StandardCalculatorViewModel.cpp
129 27 1
void UnitConverter::SendCommand()
in src/CalcManager/UnitConverter.cpp
120 31 1
PNUMBER StringToNumber()
in src/CalcManager/Ratpack/conv.cpp
117 31 3
void ChangeConstants()
in src/CalcManager/Ratpack/support.cpp
117 5 2
void StandardCalculatorViewModel::OnPaste()
in src/CalcViewModel/StandardCalculatorViewModel.cpp
117 33 1
ButtonInfo StandardCalculatorViewModel::MapCharacterToButtonId()
in src/CalcViewModel/StandardCalculatorViewModel.cpp
106 40 1
void CHistoryCollector::AddUnaryOpToHistory()
in src/CalcManager/CEngine/History.cpp
105 33 3
void powratcomp()
in src/CalcManager/Ratpack/exp.cpp
105 18 4
void LocalizationService::UpdateFontFamilyAndSize()
in src/CalcViewModel/Common/LocalizationService.cpp
100 14 1
task Grapher::TryUpdateGraph()
in src/GraphControl/Control/Grapher.cpp
100 17 1
public static string GetColorAutomationName()
in src/Calculator/Views/GraphingCalculator/EquationStylePanelControl.xaml.cs
97 32 1
protected override void OnApplyTemplate()
in src/Calculator/Controls/EquationTextBox.cs
95 17 0