microsoft / Windows-appsample-customers-orders-database
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 148 units with 1,531 lines of code in units (34.0% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 13 medium size units (366 lines of code)
    • 50 small units (705 lines of code)
    • 85 very small units (460 lines of code)
0% | 0% | 23% | 46% | 30%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs0% | 0% | 23% | 46% | 30%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
ContosoApp/Views0% | 0% | 33% | 38% | 28%
ContosoApp/ViewModels0% | 0% | 20% | 63% | 16%
ContosoApp0% | 0% | 47% | 44% | 7%
ContosoRepository/Sql0% | 0% | 30% | 34% | 34%
ContosoService/Controllers0% | 0% | 0% | 63% | 36%
ContosoApp/UserControls0% | 0% | 0% | 26% | 73%
ContosoRepository/Rest0% | 0% | 0% | 0% | 100%
ContosoService0% | 0% | 0% | 0% | 100%
ContosoModels0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private void AppShell_KeyDown()
in ContosoApp/AppShell.xaml.cs
37 19 2
protected async override void OnNavigatingFrom()
in ContosoApp/Views/CustomerDetailPage.xaml.cs
35 6 1
protected async override void OnNavigatingFrom()
in ContosoApp/Views/OrderDetailPage.xaml.cs
35 6 1
public async Task GetAsync()
in ContosoRepository/Sql/SqlOrderRepository.cs
35 7 1
private async void CustomerSearchBox_TextChanged()
in ContosoApp/Views/CustomerListPage.xaml.cs
30 9 2
private async Task SetUserPhoto()
in ContosoApp/ViewModels/AuthenticationViewModel.cs
27 2 1
protected override void OnLaunched()
in ContosoApp/App.xaml.cs
25 4 1
private async Task FilterCustomerList()
in ContosoApp/Views/CustomerListPage.xaml.cs
25 8 1
private async void RefreshButton_Click()
in ContosoApp/Views/OrderDetailPage.xaml.cs
25 4 2
public async Task LoginAsync()
in ContosoApp/ViewModels/AuthenticationViewModel.cs
24 3 0
public void UpdateOrderSuggestions()
in ContosoApp/ViewModels/OrderListPageViewModel.cs
24 7 1
public async Task SaveOrderAsync()
in ContosoApp/ViewModels/OrderViewModel.cs
23 3 0
private void EditButton_Click()
in ContosoApp/Views/OrderListPage.xaml.cs
21 2 2
public async void LoadOrders()
in ContosoApp/ViewModels/OrderListPageViewModel.cs
19 2 0
protected override void OnNavigatedTo()
in ContosoApp/Views/CustomerDetailPage.xaml.cs
19 2 1
private void OnNavigatingToPage()
in ContosoApp/AppShell.xaml.cs
18 5 2
private async Task SetUserInfoAsync()
in ContosoApp/ViewModels/AuthenticationViewModel.cs
18 1 1
public async Task GetCustomerListAsync()
in ContosoApp/ViewModels/MainViewModel.cs
18 3 0
private async void SaveButton_Click()
in ContosoApp/Views/OrderDetailPage.xaml.cs
18 2 2
public async Task LoadOrdersAsync()
in ContosoApp/ViewModels/CustomerViewModel.cs
17 2 0