Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Time to understand a program by LOC

Tags:

metrics

Are there any broad, overgeneralized and mostly useless rules about how long it will take to understand a program based on the number of LOC (lines of code)?

(I understand any rules will be broad, overgeneralized and mostly useless. That's fine.)

(The language in question is Delphi, but that shouldn't matter because I'm looking for broad, overgeneralized and mostly useless rules.)

like image 283
Instance Hunter Avatar asked Dec 01 '22 12:12

Instance Hunter


1 Answers

It's not the number of LOC that determines how long it takes to understand a program, it's more the complexity.

If my program had 100,000 lines of print statements, I think the program is pretty clear to understand. However if I had a program with for-loops nested ten deep, I think that will take far longer to understand.

Cyclomatic complexity can give a ROUGH indication of how hard the code is to understand, and can signal some other warning flags as well about your code.

like image 59
AlbertoPL Avatar answered Mar 11 '23 13:03

AlbertoPL