3 ms·
I just wanted to point out that short code paths don't necessarily translate to poor code. Measuring the quality of code is tricky and certainly modularity is
by todd8 11y ago
I just wanted to point out that short code paths don't necessarily translate to poor code. Measuring the quality of code is tricky and certainly modularity is a positive, but just having a short fast code path doesn't mean the code isn't modular.
I took a brief glance at the wheezy repo. The functions and methods looked pretty modular to me.
$ sloccount $(find src -type d| grep -v tests)
...
SLOC Directory SLOC-by-Language (Sorted)
994 handlers python=994
451 src python=451
316 middleware python=316
Totals grouped by language (dominant language first):
python: 1761 (100.00%)
Only 1761 non-test LOC, hmm... let's find out how large the functions really are:
$ cat $( find scr -name '*.py' | grep -v tests ) | grep 'def ' | wc -l
87
$ cat $( find scr -name '*.py' | grep -v tests ) | grep 'class ' | wc -l
19
There appear to be 87 functions and methods in a total of 19 classes. This means the average function size is only 20 lines of code.