microsoft / BotFramework-BlogSamples
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 484 units with 5,964 lines of code in units (48.9% of code).
    • 2 very long units (292 lines of code)
    • 6 long units (356 lines of code)
    • 48 medium size units (1,409 lines of code)
    • 165 small units (2,409 lines of code)
    • 263 very small units (1,498 lines of code)
4% | 5% | 23% | 40% | 25%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs5% | 5% | 21% | 42% | 24%
js0% | 10% | 34% | 29% | 25%
ts0% | 0% | 38% | 23% | 38%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
blog-samples/CSharp8% | 2% | 18% | 44% | 25%
SDKV4-Samples/dotnet_core0% | 13% | 38% | 29% | 18%
StackOverflow-Bot/DialogAnalyzerFunc0% | 13% | 14% | 41% | 30%
SDKV4-Samples/js0% | 12% | 46% | 22% | 18%
docs-samples/v3Node0% | 49% | 24% | 10% | 15%
blog-samples/Node0% | 0% | 57% | 8% | 33%
docs-samples/V40% | 0% | 41% | 34% | 24%
docs-samples/CSharp0% | 0% | 0% | 75% | 24%
docs-samples/Node0% | 0% | 0% | 80% | 20%
StackOverflow-Bot/StackBot0% | 0% | 0% | 0% | 100%
StackOverflow-Bot/StackCode0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
public static async Task DoExport()
in blog-samples/CSharp/BotStateExport/BotStateExport/BotStateExport/Program.cs
173 31 1
private async Task Trivia_ProcessAnswer()
in blog-samples/CSharp/TriviaBotSpeechSample/TriviaBot/TriviaDialog.cs
119 24 3
private async void OnConversationUpdated()
in blog-samples/CSharp/TriviaBotSpeechSample/TriviaApp/MainPage.xaml.cs
72 14 2
public async Task OnTurnAsync()
in SDKV4-Samples/dotnet_core/DialogInterruptionsBot/DialogInterruptionsBot.cs
70 14 2
private static async Task FillOutUserProfileAsync()
in SDKV4-Samples/dotnet_core/PromptUsersForInput/CustomPromptBot.cs
56 8 3
public static async Task Run()
in StackOverflow-Bot/DialogAnalyzerFunc/AnalyzeDialog.cs
56 10 3
static async fillOutUserProfile()
in SDKV4-Samples/js/PromptUsersForInput/bot.js
51 13 3
function loadSession()
in docs-samples/v3Node/startNewDialog/botadapter.js
51 9 3
public async static Task Send_LightningModeStart()
in blog-samples/CSharp/TriviaBotSpeechSample/TriviaBot/Runtime/Responses.cs
49 3 2
public async Task OnTurnAsync()
in SDKV4-Samples/dotnet_core/DialogPromptBot/DialogPromptBot.cs
46 5 2
public async Task OnTurnAsync()
in SDKV4-Samples/dotnet_core/ComplexDialogBot/ComplexDialogBot.cs
44 10 2
public async Task MessageReceivedAsync()
in blog-samples/CSharp/TriviaBotSpeechSample/TriviaBot/TriviaDialog.cs
42 7 2
function SaveEntities()
in docs-samples/V4/JS/contosocafebot-luis-dialogs/lib/luisbot.js
37 8 2
public async Task OnTurnAsync()
in SDKV4-Samples/dotnet_core/StateBot/StateBot.cs
36 4 2
private static async Task LoopStepAsync()
in SDKV4-Samples/dotnet_core/DialogInterruptionsBot/DialogInterruptionsBot.cs
35 6 2
async onTurn()
in SDKV4-Samples/js/DialogPromptBot/bot.js
35 8 1
private static async Task QueryLuisWithRetry()
in blog-samples/CSharp/TriviaBotSpeechSample/TriviaBot/Luis/QueryLuis.cs
35 4 4
async function SaveEntities()
in docs-samples/V4/JS/contosocafebot-luis-dialogs/src/luisbot.ts
35 8 2
yield takeEvery()
in blog-samples/Node/Blog-Redux-Bot/redux/sagas/default.js
34 11 2
private static bool ValidateDate()
in SDKV4-Samples/dotnet_core/PromptUsersForInput/CustomPromptBot.cs
33 8 3