(‘Violations of DRY are typically referred to as WET solutions, which is commonly taken to stand for either “write everything twice”, “we enjoy typing” or “waste everyone’s time”. ’)
How about conceptual duplication? Besides, not all code contributes to project complexity. For instance no one would argue if I said the same project could be considered less complex if we kept the non-comment code exactly the same and added new useful comments on top of it. I’d argue that the same is true for type annotations. Value-level code describes what the program does. Type-level code describes what the program can’t do, so it’s a net reduction in project complexity.
This immediately suggests another metric:
DRYness = ULOC / SLOC
Or if you prefer,
WETness = 1 - DRYness
(‘Violations of DRY are typically referred to as WET solutions, which is commonly taken to stand for either “write everything twice”, “we enjoy typing” or “waste everyone’s time”. ’)
I was thinking the same. Immediately had a look at my main codebase at my day job. DRYness: 0.44. Subjectively I’d say it’s somewhat WET.
if you want to see them with counts, and no whitespace at the front or end, then there’s this terrible one-liner:
For me they both give the same metrics
edit: just a bizarre coincidence
How about conceptual duplication? Besides, not all code contributes to project complexity. For instance no one would argue if I said the same project could be considered less complex if we kept the non-comment code exactly the same and added new useful comments on top of it. I’d argue that the same is true for type annotations. Value-level code describes what the program does. Type-level code describes what the program can’t do, so it’s a net reduction in project complexity.