Skip to main content
1 of 2
gbjbaanb
  • 48.8k
  • 7
  • 106
  • 174

The easiest way is to ask from a point of not understanding and ask their opinion. Its no good to say "your code sucks", its quite another to say "erm, I saw this and I really can't understand what its doing, or why its doing it. What do you think?" or similar - you could say what your concern is and ask them to explain it to you, or ask them just if you are right.

This way, you bring them into being part of the solution and typically will realise the problem and fix it themselves (or you can offer to do it for them).

I'm sure you've written code like that yourself, you just don't see it until someone points it out and you have a d'oh moment. Treat such code not as a huge, glaring error but as just another slight cock up that we all make now and then and you'll be good.

gbjbaanb
  • 48.8k
  • 7
  • 106
  • 174