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.
"If you have to spend effort into looking at a fragment of code to figure out what it's doing, then you should extract it into a function and name the function after that 'what'."
"Use common sense, stick to small function sizes in most instances but don't be dogmatic about it if you have a genuinely good reason to make an unusually big function."
"All other things being equal, a shorter method is easier to read, easier to understand, and easier to troubleshoot. Refactor long methods into smaller methods if you can."
"The first rule of functions is that they should be small. The second rule of functions is that they should be smaller than that. Functions should not be 100 lines long. Functions should hardly ever be 20 lines long."
Unit Size Overall
There are 2,806 units with 25,870 lines of code in units (24.6% of code).
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
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