by Waterluvian · 4y ago · 0 comments
Could we describe “ideas” or “logical units” in some way? Or maybe just count the number of keywords and operators?
I find that “lines” is so popular but almost always misrepresents simple code as being more complex, and complex code as being simpler.
Of course, lines, like in this post, can be a perfectly helpful answer to a question if the question isn’t “where’s all the complexity?”
You can try to measure Cyclomatic complexity, so that's more useful in practice.
And to make matters worse, we don't actually know how to calculate the true Kolmogorov complexity of anything because humans are notoriously bad at figuring out what "the smallest program" actually is, so it's a great device for reasoning about complexity, but it's a near useless device for determining actual complexity.
I find it a very elegant concept about complexity (even if not very practical), and wanted to share it regardless to be honest ;)
https://pragprog.com/titles/atcrime/your-code-as-a-crime-sce...
Fortunately, the word complexity was not used there, and it's nice to see if this subsystem, or protocol, or driver, etc takes two orders of magnitude more than the others.
Programming does not need to involve itself with the hardware, that’s just a tool for evaluation. A program is an idea expressed in a language. It’s some formal statement of intent. Sometimes we can evaluate it to produce an output. Sometimes these statements are muddied by underlying representations.
The length of a declarative program seems a pretty good rough measure of complexity in the way you are talking about. Operational complexity of course, in the number of steps to actually evaluate it is a bit different, based on what you are using.