- The Direct Approach: Tell them you don't understand how their code is written and add something like "Here's what you can do to help me understand," says Tim Burks, a software developer and organizer of the Silicon Valley iOS Developer's Meetup.
- Go Cerebral: Take them out for a beer or two, engage their cerebrum and start a discussion about coding style. You may find they do what they do because that style works for them — just not the team. By discussing how code is as much about communication between people as it is between people and machines, you can get your co-worker thinking in a whole new way.
- Hero talk: Assuming your colleagues respect you, they may appreciate and wish to emulate the type of coders you admire. So, tell them who those coders are. And maybe share Burks's observation that ace developers are those who can blend their style in with the styles of others.
- Pick Your Battles: "Reformatting code for formatting's sake will likely go nowhere on its own," says Tom Jacobs, who leads Adobe System's research lab. "But reformatting as part of re-factoring, adding features or fixing bugs shouldn't cause any trouble because substantial value is being added to the open source."
- Criticism v. Feedback: People would rather get feedback than criticism, even if it's negative feedback, observes psychologist Leon Seltzer on Psychology Today's blog. So position the conversation that way.
- Futuristic Approach: Instead of critiquing current work, ask for specific changes in future projects. Think of it this way: "Hey, in the future, it would be great if you could keep your code down to 10 lines or less per method." That's easier to hear than "Your code is a tangled mess."
- Make a Sandwich: Sandwich your criticism, using a layer of compliments before and after you deliver your "code sucks" message.
- It's All About "We": Starting this kind of conversation with "you" can come across as hostile, as if you're making an accusation. So rather than saying, "You always write code that I have to clean up," begin with "I sometimes feel frustrated when I need to rewrite your code."
- Misdirect the Eye: This approach will require more work, and is certainly an example of passive aggression, but think of organizing some kind of coding challenge for you group. Ideally, it could provide a safe, subtle way to begin a discussion of how your colleague's coding can improve.
10 Nice Ways to Say 'Your Code Sucks'
When you've got a colleague whose work looks more like Medusa's hair than code that's actually supposed to do something, you don't have many good options: You can fix it yourself, complain to your manager, whisper about it to other team members, hold it all in until your head explodes or, maybe the scariest of all, go talk to the messy coder directly. The truth is, the scariest option is also the best. Most of the time, you can do it in a way that doesn't turn onto a shouting match or hurt feelings. It's like the old saying goes: You can tell people anything, as long as you tell them the right way. Of course, coming up with that right way isn't the simplest thing in the world. To ease your way, here are 10 ways to get your message across artfully.