Re:Qualities of clean code
by nickpsecurity on Thursday September 15, 2016 @10:29AM
(#12506423)
Let's take a page from the Orange Book days. Simplicity means you can:
1. Clearly map the code/functions to the specs of what it does almost line by line.
2. The code is expressed in a way simple enough for one person to understand it and verify it by hand.
3. The code is expressed in a way simple enough for a machine to verify it should someone want to try.
4. Minimal to no global effects/state happening in the local code.
These principles tend to result in code that's correct and easy to modify. I say they're a start on some objective measure of simplicity. We could empirically [dis]prove them as well with tests of various coding styles on people and tooling.
1. Clearly map the code/functions to the specs of what it does almost line by line.
2. The code is expressed in a way simple enough for one person to understand it and verify it by hand.
3. The code is expressed in a way simple enough for a machine to verify it should someone want to try.
4. Minimal to no global effects/state happening in the local code.
These principles tend to result in code that's correct and easy to modify. I say they're a start on some objective measure of simplicity. We could empirically [dis]prove them as well with tests of various coding styles on people and tooling.