4 ms·
Code complexity is a thing. It doesnt describe understandability but its a pretty decent proxy in my experience. > In 1976, Thomas McCabe Snr proposed a metric
by waheoo 6y ago
Code complexity is a thing. It doesnt describe understandability but its a pretty decent proxy in my experience.
> In 1976, Thomas McCabe Snr proposed a metric for calculating code complexity, called Cyclomatic Complexity.
https://blog.codacy.com/an-in-depth-explanation-of-code-complexity/ https://blog.codacy.com/an-in-depth-explanation-of-code-comp...
There is also likely some simple metrics you could get by looking at names of things alone.
Common substrings, length, and diversity of names are probably decent indicators.
- flukus 6y agoUnderstandability here is more of an umbrella term for the system as a whole, cyclomatic complexity is generally only useful for much more isolated chunks of code. Reducing CC can also make the the system as a whole less understandable, moving an inner loop into it's own function for a simple example will reduce the cyclomatic complexity of the outer function yet the complexity hasn't really changed and now there is more indirection for the developer to deal with. It's a good tool for telling you how complicated a piece of code is, but generally there aren't many options to reduce it other than hacking the metric and making the system as a whole more complicated and less understandable.
- waheoo 6y agoI wonder if there is any comprehension metrics we could use in its place, similar how you can measure reading comprehension levels of certain text?