"The hurrider I go, the behinder I get," is one of the phrases I like to trot out any time a project schedule slips and a PHB or PM decides the solution is either crunch or throwing more bodies at the project.
Karl had one of those bosses, and ended up in the deep end of crunch. Of course, when that happens, mistakes happen, and everything gets further behind, or you're left with a mountain of technical debt because you forgot that Integer.TryParse
was a function in C#.
Which is what happened to Karl. And that's why Karl wrote… this.
private static bool IsNum(string num)
{
for (int i = 0; i < num.Length; i++)
{
for (int j = 0; j <= 10; j++)
{
if (j == 10) return false;
if (num.Substring(i, 1) == j.ToString()) break;
}
}
return true;
}
This is an impressive brain-fart. Nested loops, multiple escape clauses from the inner loop which return control to different places. All the calls to Substring
and ToString
.
Unfortunately for Karl, this code shipped, and unless there are any show stopping bugs, none of the existing code is ever to be touched again. Everyone should be focused on writing new features for the next release.