Hacker News new | ask | show | jobs
by kazinator 3760 days ago
Looking at the static picture is somewhat misleading. The lines of code you see in the current baseline snapshots are not all the lines that were ever written for that project.

A fairly large and extensive commit affecting many lines can have a small impact on the absolute number of lines (which can even shrink). We change as well as delete existing lines, not only add new ones.

The lines which are replaced by new lines should be regarded as deleted lines, and so the figure of how many lines there are now should be supplemented with how many lines were deleted since the beginning of the project: how many additional lines of code exist in the repo's history, which no longer appear in the current baseline.

The invisible lines that disappeared in the history are the underpinning for the current lines; they enabled the new lines to be figured out, which took work. Someone had to write each line, and it has to be counted in the LOC output.

It is not entirely clear cut. If you make a trivial change in some existing line, it's not the same thing as a brand new line. Yet, according to the line-based diff tools, it looks like a deletion and addition of an entire line. Minus this, plus that.