I spent entirely too much time debugging the following today:
int foo(int num, int l) {
int baz = 1;
int bar = l;
return bar + baz;
}
What gets returned for foo(2,2)?
If you guessed 2, you are dumb like me. If you guessed 3, you noticed that the author of this broken code used a variable named “l”, and despite the fact that it looks like a “1”, it is not!
It’s easy to write code that machines understand. The hard part about being a software engineer is writing code that both machine AND man can understand.