4 ms·
"Lines" is short for "lines of code" I would say so comments and whitespace would not count. But holistically speaking you are right of course.
by marhee 4y ago
"Lines" is short for "lines of code" I would say so comments and whitespace would not count. But holistically speaking you are right of course.
- dang 4y agoThere's other whitespace in there that does get counted - for example, LOC is different depending on whether you prefer K&R braces. And since comments compensate for things that code doesn't directly express, it probably makes sense to include them too. If we're trying to measure code complexity I think we have to ask "complexity to whom". If it's to humans, we should measure the code as it appears to humans. If it's to machines, then "line" is meaningless and we should look at tokens, the way PG suggested years ago.
- Hoppetosse 4y agoBob Nystrom describes his language Wren through number of semicolons, which I find interesting. Doesn't work for every language, though =P
- samatman 4y agoGosh dang, I have to remind myself that you're more than entitled to technical opinions as well! A tight definition of SLOC isn't something we have. We do have sloccount, or we can install it, different tool from `wc -l` (we can sed the blank lines out first). Really we should be calculating cyclomatic complexity like adults. I'm told this isn't straightforward! But what is the use of heaven if a man's reach cannot exceed his grasp.