Today’s first snippet comes from some work that was submitted to Yndy from a new coder for his company’s code review. The second snippet is the revision to that code.
Yndy’s company’s coding standards are pretty straightforward. One states “variable names shall differ by more than one character.” It’s pretty reasonable: who wants to accidentally use “day” instead of “days” when both are declared in scope? Another is just as reasonable: inline comments should be added at the point of variable declaration to make the code more understandable. Apparently, neither rule made sense to Yndy’s coder…
int T, L, W, H;
After Yndy explained the rules and why they’re generally good coding practices, the coder assured him that he’d have the code revised the following day. And that he did…
int TT, LL, WW, HH; // Top, Left, Width, Height
Technically to the letter… not so much to the spirit.