Earlier quoted context omitted.
Have you never seen a piece of code that sucked so much that you could shrink it by a factor of at least 2? You lucky swine… Much (possibly most) code I have had to deal with was that ugly.
Almost all code except the stuff written by the Masters of Succinctness can be shrunk by a factor of 2. Order of magnitude reduction is the only impressive metric.
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.