anthropics / beam
Unit Size

The distribution of size of units (measured in lines of code).

Intro
Learn more...
  • To learn more about unit size, the Sokrates recommends the following resources:
    • Function Length, MartinFowler.com
      • "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'."
    • Stack Overflow Discussion on Unit Size, stackoverflow.com
      • "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."
    • Coding Smells, codinghorror.com
      • "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."
    • Clean Code: A Handbook of Agile Software Craftsmanship, by Robert Martin
      • "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
6% | 8% | 24% | 22% | 37%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
java4% | 8% | 24% | 22% | 39%
go13% | 7% | 20% | 21% | 37%
py3% | 10% | 28% | 23% | 34%
groovy71% | 9% | 9% | 4% | 5%
ts4% | 9% | 29% | 24% | 31%
tsx42% | 12% | 4% | 24% | 16%
dart1% | 9% | 30% | 25% | 33%
js0% | 0% | 35% | 22% | 42%
pyx0% | 0% | 32% | 8% | 59%
kt0% | 0% | 7% | 25% | 66%
h0% | 0% | 73% | 0% | 26%
kts0% | 0% | 0% | 100% | 0%
pyi0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
sdks6% | 9% | 24% | 21% | 37%
runners4% | 9% | 25% | 23% | 37%
buildSrc81% | 8% | 5% | 2% | 2%
playground5% | 8% | 23% | 29% | 33%
learning3% | 2% | 15% | 33% | 44%
scripts5% | 9% | 54% | 15% | 14%
it1% | 2% | 28% | 26% | 41%
infra0% | 14% | 45% | 28% | 10%
release0% | 13% | 41% | 21% | 23%
.test-infra0% | 4% | 43% | 21% | 31%
website0% | 2% | 31% | 23% | 42%
.github0% | 0% | 83% | 0% | 16%
contributor-docs0% | 0% | 28% | 18% | 53%
plugins0% | 0% | 0% | 48% | 51%
Alternative Visuals
Longest Units
Top 50 longest units
Unit# linesMcCabe index# params
2127 190 1
840 195 0
822 378 1
822 378 1
566 138 0
566 138 0
446 47 6
373 10 0
342 81 0
341 83 1
334 63 1
329 65 1
324 94 4
310 32 1
289 59 2
275 41 1
270 57 0
266 60 0
261 35 3
248 52 1
238 19 1
237 45 4
236 7 24
232 46 3
227 36 13
219 14 0
217 28 1
215 26 8
212 31 6
206 48 7
202 45 1
202 4 2
200 47 2
199 23 1
198 8 1
198 19 1
197 44 0
194 45 0
191 18 1
185 26 2
185 5 2
183 32 2
183 83 2
182 37 1
179 39 0
175 1 3
174 7 3
173 24 1
172 14 6
167 3 2