I talk about code that I can shrink by a factor of 2. Most often without even understanding what the code does, just applying local correctness-preserving transformations.
I'm talking about horrors such as (this was real, production code):
bool flag = true;
if (var1 == const1)
{
if (var2 == const2)
{
// quite a lot of code
flag = false;
}
}
if (flag == true)
{
// a little piece of code.
}
Clearly, someone forgot to clean up their code. It doesn't take a Master of Succinctness to realize that
if (var1 != const1 ||
var2 != const2)
{
// a little piece of code
}
else
{
// quite a lot of code
}
is much better (the code represented by the comments didn't touch the flag). Plus, such simplifications tend to compound. After a first pass, I often see more possible reductions that can be used for a second, sometimes a third pass.
I'm talking about horrors such as (this was real, production code):
Clearly, someone forgot to clean up their code. It doesn't take a Master of Succinctness to realize that is much better (the code represented by the comments didn't touch the flag). Plus, such simplifications tend to compound. After a first pass, I often see more possible reductions that can be used for a second, sometimes a third pass.