microsoft / ai-edu
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 2,806 units with 25,870 lines of code in units (24.6% of code).
    • 4 very long units (780 lines of code)
    • 17 long units (1,214 lines of code)
    • 203 medium size units (5,722 lines of code)
    • 524 small units (7,597 lines of code)
    • 2,058 very small units (10,557 lines of code)
3% | 4% | 22% | 29% | 40%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cs12% | 20% | 30% | 13% | 23%
py1% | 2% | 20% | 31% | 43%
java0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
#U5b9e#U8df5#U6848#U4f8b/B09-#U624b#U5199#U7b97#U5f0f#U8ba1#U7b97#U566828% | 0% | 12% | 22% | 35%
#U5b9e#U8df5#U9879#U76ee/2019_MSC_#U9ec4#U91d1#U70b915% | 36% | 22% | 10% | 15%
#U57fa#U7840#U6559#U7a0b/A2-#U795e#U7ecf#U7f51#U7edc#U57fa#U672c#U539f#U7406<1% | 1% | 20% | 32% | 45%
#U57fa#U7840#U6559#U7a0b/A7-#U5f3a#U5316#U5b66#U4e600% | 44% | 0% | 17% | 38%
#U5b9e#U8df5#U6848#U4f8b/B03-#U770b#U56fe#U8bc6#U718a0% | 29% | 28% | 7% | 34%
#U5b9e#U8df5#U6848#U4f8b/B05-#U6587#U672c#U6717#U8bfb#U5e94#U75280% | 38% | 25% | 19% | 16%
#U57fa#U7840#U6559#U7a0b/A4-#U7ecf#U5178#U673a#U5668#U5b66#U4e60#U7b97#U6cd5#Uff08#U66f4#U65b0#U4e2d#Uff090% | 0% | 24% | 32% | 43%
#U5b9e#U8df5#U6848#U4f8b/B15-#U57fa#U4e8e#U6df1#U5ea6#U5b66#U4e60#U7684#U4ee3#U7801#U641c#U7d22#U6848#U4f8b0% | 0% | 50% | 18% | 30%
#U5b9e#U8df5#U6848#U4f8b/B01-#U6f2b#U753b#U7ffb#U8bd10% | 0% | 70% | 16% | 13%
#U5b9e#U8df5#U6848#U4f8b/B06-#U642d#U5efa#U4e2d#U95f4#U670d#U52a1#U5c420% | 0% | 44% | 14% | 41%
#U57fa#U7840#U6559#U7a0b/A1-Python#U4e0e#U57fa#U7840#U77e5#U8bc60% | 0% | 17% | 52% | 30%
#U5b9e#U8df5#U6848#U4f8b/B07-#U624b#U5199#U6570#U5b57#U8bc6#U522b0% | 0% | 49% | 0% | 50%
#U5b9e#U8df5#U6848#U4f8b/B12-#U57fa#U4e8e#U8fd1#U90bb#U56fe#U7684#U5411#U91cf#U641c#U7d22#U6848#U4f8b0% | 0% | 38% | 38% | 22%
#U5b9e#U8df5#U6848#U4f8b/B04-#U667a#U80fd#U5bb6#U5c450% | 0% | 19% | 47% | 32%
#U5b9e#U8df5#U6848#U4f8b/B02-#U95ee#U7b54#U7cfb#U7edf#U548c#U5bf9#U8bdd#U673a#U5668#U4eba#U670d#U52a10% | 0% | 50% | 0% | 50%
#U57fa#U7840#U6559#U7a0b/A3-#U795e#U7ecf#U7f51#U7edc#U9ad8#U7ea7#U6a21#U578b#Uff08#U5f81#U7a3f#Uff090% | 0% | 0% | 85% | 14%
#U5b9e#U8df5#U6848#U4f8b/B13-AI#U5bf9#U8054#U751f#U6210#U6848#U4f8b0% | 0% | 0% | 8% | 91%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
private void InitializeComponent()
in #U5b9e#U8df5#U9879#U76ee/2019_MSC_#U9ec4#U91d1#U70b9/#U5fae#U8f6f#U9ec4#U91d1#U70b9#U7a0b#U5e8f#U5de5#U5177/OfflineGame/GameMaster/LocalManager/LocalManager/MainForm.Designer.cs
298 1 0
def main()
in #U5b9e#U8df5#U6848#U4f8b/B09-#U624b#U5199#U7b97#U5f0f#U8ba1#U7b97#U5668/src/tensorflow_model/mnist_extension.py
194 28 1
def ModelTransfer()
in #U57fa#U7840#U6559#U7a0b/A2-#U795e#U7ecf#U7f51#U7edc#U57fa#U672c#U539f#U7406/#U7b2c6#U6b65 - #U6a21#U578b#U90e8#U7f72/src/ch13-ModelInference/ONNXConverter/transfer.py
164 6 2
private void writeArea_MouseUp()
in #U5b9e#U8df5#U6848#U4f8b/B09-#U624b#U5199#U7b97#U5f0f#U8ba1#U7b97#U5668/src/extended_mnist_calculator/MNIST.App/MainWindow.cs
124 18 2
private void btnSelectBots_Click()
in #U5b9e#U8df5#U9879#U76ee/2019_MSC_#U9ec4#U91d1#U70b9/#U5fae#U8f6f#U9ec4#U91d1#U70b9#U7a0b#U5e8f#U5de5#U5177/OfflineGame/GameMaster/LocalManager/LocalManager/MainForm.cs
95 13 2
static async Task RunBot()
in #U5b9e#U8df5#U9879#U76ee/2019_MSC_#U9ec4#U91d1#U70b9/#U5fae#U8f6f#U9ec4#U91d1#U70b9#U7a0b#U5e8f#U5de5#U5177/OnlineGame/BotDemoInCSharp/BotDemo/Program.cs
93 13 1
private async void StartButton_Click()
in #U5b9e#U8df5#U9879#U76ee/2019_MSC_#U9ec4#U91d1#U70b9/#U5fae#U8f6f#U9ec4#U91d1#U70b9#U7a0b#U5e8f#U5de5#U5177/OfflineGame/Player/OfflineScoreboard/MainWindow.xaml.cs
92 14 2
private void InitializeComponent()
in #U5b9e#U8df5#U6848#U4f8b/B05-#U6587#U672c#U6717#U8bfb#U5e94#U7528/src/TTS_Demo/Form1.Designer.cs
91 1 0
def main()
in #U5b9e#U8df5#U9879#U76ee/2019_MSC_#U9ec4#U91d1#U70b9/#U5fae#U8f6f#U9ec4#U91d1#U70b9#U7a0b#U5e8f#U5de5#U5177/OnlineGame/BotDemoInPython/RLBotDemo.py
86 19 3
def color()
in #U57fa#U7840#U6559#U7a0b/A2-#U795e#U7ecf#U7f51#U7edc#U57fa#U672c#U539f#U7406/src/Data/ch18_color.py
81 6 0
def mp_simulate()
in #U57fa#U7840#U6559#U7a0b/A7-#U5f3a#U5316#U5b66#U4e60/02-#U591a#U81c2#U8d4c#U535a#U673a/src/bandit_20_base.py
73 10 6
def main()
in #U5b9e#U8df5#U9879#U76ee/2019_MSC_#U9ec4#U91d1#U70b9/#U5fae#U8f6f#U9ec4#U91d1#U70b9#U7a0b#U5e8f#U5de5#U5177/OnlineGame/BotDemoInPython/BotDemo.py
71 14 3
private async Task RunOneRoundAsync()
in #U5b9e#U8df5#U9879#U76ee/2019_MSC_#U9ec4#U91d1#U70b9/#U5fae#U8f6f#U9ec4#U91d1#U70b9#U7a0b#U5e8f#U5de5#U5177/OfflineGame/GameMaster/LocalManager/LocalManager/MainForm.cs
67 8 0
def model_save()
in #U57fa#U7840#U6559#U7a0b/A2-#U795e#U7ecf#U7f51#U7edc#U57fa#U672c#U539f#U7406/#U7b2c6#U6b65 - #U6a21#U578b#U90e8#U7f72/src/ch13-ModelInference/ONNXConverter/save.py
65 10 2
def staristic()
in #U57fa#U7840#U6559#U7a0b/A7-#U5f3a#U5316#U5b66#U4e60/02-#U591a#U81c2#U8d4c#U535a#U673a/src/bandit_28_all.py
62 4 3
public async Task RunAsync()
in #U5b9e#U8df5#U9879#U76ee/2019_MSC_#U9ec4#U91d1#U70b9/#U5fae#U8f6f#U9ec4#U91d1#U70b9#U7a0b#U5e8f#U5de5#U5177/OfflineGame/GameMaster/LocalManager/BotRun/Bot.cs
62 7 2
public ScoreCalculationResult CalculateScore()
in #U5b9e#U8df5#U9879#U76ee/2019_MSC_#U9ec4#U91d1#U70b9/#U5fae#U8f6f#U9ec4#U91d1#U70b9#U7a0b#U5e8f#U5de5#U5177/OfflineGame/Player/OfflineScoreboard/Utils/ScoreHelper.cs
62 5 2
def try_filters()
in #U57fa#U7840#U6559#U7a0b/A2-#U795e#U7ecf#U7f51#U7edc#U57fa#U672c#U539f#U7406/#U7b2c8#U6b65 - #U5377#U79ef#U795e#U7ecf#U7f51#U7edc/src/ch17-CNNBasic/Level0_KnowCNN.py
58 2 1
private void InitializeComponent()
in #U5b9e#U8df5#U6848#U4f8b/B03-#U770b#U56fe#U8bc6#U718a/src/OnnxWithToolsForAI/ClassifyBear/Form1.Designer.cs
53 1 0
private void InitializeComponent()
in #U5b9e#U8df5#U6848#U4f8b/B03-#U770b#U56fe#U8bc6#U718a/src/OnnxWithRuntime/ClassifyBear/Form1.Designer.cs
52 1 0