Browse Source

Add ULOC

master
Causal Agent 6 months ago
parent
commit
f20b767fa3
Signed by: Curtis McEnroe <june@causal.agency> GPG Key ID: CEA2F97ADCFCD77C
2 changed files with 65 additions and 0 deletions
  1. 64
    0
      004-uloc.7
  2. 1
    0
      Makefile

+ 64
- 0
004-uloc.7 View File

@@ -0,0 +1,64 @@
1
+.Dd December 14, 2018
2
+.Dt ULOC 7
3
+.Os "Causal Agency"
4
+.
5
+.Sh NAME
6
+.Nm ULOC
7
+.Nd unique lines of code
8
+.
9
+.Sh DESCRIPTION
10
+There are many tools available
11
+which measure SLOC: source lines of code.
12
+These tools are strangely complex
13
+for what they intend to do,
14
+which is to estimate the relative sizes of projects.
15
+They perform some amount of parsing
16
+in order to discount comments in various languages,
17
+and for reasons unknown each format their ouput
18
+in some oddly encumbered way.
19
+.
20
+.Pp
21
+I propose a much simpler method
22
+of estimating relative sizes of projects:
23
+unique lines of code.
24
+ULOC can be calculated with standard tools as follows:
25
+.
26
+.Bd -literal -offset indent
27
+sort -u *.h *.c | wc -l
28
+.Ed
29
+.
30
+.Pp
31
+In my opinion,
32
+the number this produces
33
+should be a better estimate of
34
+the complexity of a project.
35
+Compared to SLOC,
36
+not only are blank lines discounted,
37
+but so are close-brace lines
38
+and other repetitive code
39
+such as common includes.
40
+On the other hand,
41
+ULOC counts comments,
42
+which require just as much maintenance
43
+as the code around them does,
44
+while avoiding inflating the result
45
+with license headers which appear in every file,
46
+for example.
47
+.
48
+.Pp
49
+It can also be amusing
50
+to read all of your code sorted alphabetically.
51
+.
52
+.Sh AUTHORS
53
+.An C. McEnroe Aq Mt june@causal.agency
54
+.
55
+.Pp
56
+This document is produced from
57
+.Xr mdoc 7
58
+source available from
59
+.Lk https://code.causal.agency/june/text.causal.agency "Code Toilet"
60
+.
61
+.Sh CAVEATS
62
+Estimates such as these
63
+should not be used for decision making
64
+as if they were data.

+ 1
- 0
Makefile View File

@@ -3,6 +3,7 @@ WEBROOT = /usr/local/www/text.causal.agency
3 3
 TXTS += 001-make.txt
4 4
 TXTS += 002-writing-mdoc.txt
5 5
 TXTS += 003-pleasant-c.txt
6
+TXTS += 004-uloc.txt
6 7
 
7 8
 all: $(TXTS)
8 9
 

Loading…
Cancel
Save