“I’m continually amazed by the unique and clever solutions developed by my colleagues,” Mark writes. “And I should say, I don’t mean ‘amazed’ in a good, innovative-idea-to-save-company-money sort of way. It’s more a wow, that’s more wrong than I could have ever imagined sort of way.”
“Take, for example, this snippet of code that I found recently.”
for (int i = 0; i < dtModules.Rows.Count; i++) { if (dtModules.Rows[i]["id"].ToString() == ID.ToString()) { dtModules.Rows.RemoveAt(i); i = 34598; //used to jump out of the for } }
Mark adds, “perhaps the original coder thought that the word ‘break’ must be offensive to someone out? And really, it’s easier to just pick a random number to force the for-loop to exit and then hope that nobody ever has more than 34,598 modules.”
