Just to be clear simplicity is the progression towards singularity and complexity is the progression away from singularity. Complex quite literally means to put together. The terms complex and simple are completely unrelated to easy or challenging.
That said, a task accomplished by a single nasty 5000 line function is three times more simple than using 3 small 10 line functions. Inheritance means to extend and is thus inherently complex.
The simplicity of a system is the result of the competing requirements the system addresses. A system that does one thing only is simple. A system that does a few things is complex. A system that does many things is more complex.
This can be measured objectively. There is a Github plugin called Code Climate that rewards a grade to code based upon things it considers cognitively challenging. Large functions and large files are punished by that grading metric. I prefer to organize my code with lexical scope because the structure of code directly reflects the availability of capabilities. That is more simple but it also tends to result in really large functions that are trees of child functions. In this sense the Code Climate grading metric punishes that form of simplicity and instead suggests breaking things apart into many pieces to be put together. That is a punishment of simplicity in a very direct way even though the result is clean code that is faster to read.
I think it is doing a disservice to push this as an objective measure. Not to mention, you reduce it to number of things. Some things are more complicated than others, after all. Regardless of numbers.
Still, I think, from your last, that we agree. Many intended objective measures actually don't lead to what they are pushing for. I see this in designs from peers all the time. They index on terms they understand, and miss the holistic system for it. It is very frustrating.
Complexity is objective, so a numeric measure isn’t good or bad. It’s the rules upon that number that are subjective.
I am curious about why developers find this frustrating. It is very commonly frustrating. Developers almost always claim to want simplicity until the terms are defined, which makes me wonder what they are actually wanting.
I contest that it is truly objective. Some complexity measures are objective. Most merely appear so.
Consider, who wins a sports game is objective and quite simple to define. It is whoever has the winning score. Now, the facets that go into all of the plays and other aspects of the game? Those leave the realm of simplicity quite quickly.
> Large functions and large files are punished by that grading metric. I prefer to organize my code with lexical scope because the structure of code directly reflects the availability of capabilities. That is more simple but it also tends to result in really large functions that are trees of child functions. In this sense the Code Climate grading metric punishes that form of simplicity and instead suggests breaking things apart into many pieces to be put together. That is a punishment of simplicity in a very direct way even though the result is clean code that is faster to read
That said, a task accomplished by a single nasty 5000 line function is three times more simple than using 3 small 10 line functions. Inheritance means to extend and is thus inherently complex.
The simplicity of a system is the result of the competing requirements the system addresses. A system that does one thing only is simple. A system that does a few things is complex. A system that does many things is more complex.
This can be measured objectively. There is a Github plugin called Code Climate that rewards a grade to code based upon things it considers cognitively challenging. Large functions and large files are punished by that grading metric. I prefer to organize my code with lexical scope because the structure of code directly reflects the availability of capabilities. That is more simple but it also tends to result in really large functions that are trees of child functions. In this sense the Code Climate grading metric punishes that form of simplicity and instead suggests breaking things apart into many pieces to be put together. That is a punishment of simplicity in a very direct way even though the result is clean code that is faster to read.