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.

Slipping and Falling 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.

  • 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.

Have other ideas about dealing with the author of frustrating code? Share them with everyone by posting a comment below.

12 Responses to “10 Nice Ways to Say ‘Your Code Sucks’”

  1. Is the code messy, complex to the point of obfuscation, needlessly complicated, inadequately documented, not to corporate standards, does not deliver what was promised, or a combination of the previous? Is the programmer a junior member of staff, or a veteran? Simply saying “your code sucks” is almost certainly guaranteed to not be productive. If YOU believe it’s needlessly complex you might find yourself being told you are not smart enough to recognize the genius in the design.

    With that said, years ago I was tasked with modifying a program written by a coworker. I finally decided to simply rewrite the entire program starting with original specs because I could not follow the logic in the program. IIRC, that program was the only program ever written by that particular person.

      • “It’s about diplomatically getting the message across that it’s lacking.”

        Says who? First, consider the source of the message. In many ways coding is a craft and an art form. Anyone with the stones to even diplomatically question coding should first possess enough street cred among peers to legitimately question the style used by others.

  2. Who are you to tell this person that the code sucks?
    1) If you think the code sucks and it’s a senior person, maybe, just maybe, you really have no clue how to read others’ code and should examine your own code and see if maybe others think that YOURS sucks.
    2) If you’re working in a team, rather than attacking an individual, use peer-pressure to get the code fixed by having meetings where you review each others’ code and see everyone’s style while offering reasons why you think that certain methods work better than others (and see if the others agree…legitimizing your thoughts that others’ code sucks, or maybe learning why your methods suck)
    3) Your job is not to supervise your peers; tell your boss that you think the coding stuff needs to be reviewed and see if you can have the boss get the person to work with you as a mentor or, again, have a team meeting to handle this.
    Junior members should always be mentored in style or you have no reason to complain about it; senior people probably don’t write code that sucks but its simply different and needs to be synchronized with others.
    Oh, and if it’s the boss that writes the sucky code, tread lightly.

    • I have tried the approach of asking why something is coded the way it is. That usually seems to result in an offended developer who doesn’t want to engage further and goes away pouting. Most developers are so proud of their work, they cannot take any kind of criticism, constructive or not, without getting all defensive about it. It is a very difficult thing to deal with.

  3. David Woodhouse

    My code often sucks. When this happens, I like people simply to tell me so. Directly.

    Often I’ll agree quite readily, and it may even be the first time I actually consider the offending piece of code with it being my primary focus. Odds are, it was thrown together while I was tired/drunk/distracted by baby/considered it a necessary evil before I could implement the thing I was *actually* trying to focus on.

    I promise, I will not be offended.

    If, however, you couch your criticism in misdirection and obvious disingenuity, such as pretending not to understand when you blatantly do, *then* I will be offended. Because by your actions, you will be implying that I am so unprofessional and childish that I cannot take direct criticism. I don’t work in a kindergarten, and don’t want to be treated as if I do. Reading this article just depresses me, to be honest.

    But maybe that’s just me?

    • David,

      there is a lot of “sucky” code. That’s frequently due to a prevailing “get it done NOW, not correctly” mentality. So we write it to get it done with the intent of fixing it someday but as CCR sang “Someday never comes”.


  4. To be Honest, David, based on your comments I would never hire you. You say your code sucks and you say things that make it seem like coding is a chore for you rather than something that you enjoy enough to do a good job. On the other hand, I appreciate your candor which would be so much more welcome than the egos I see over and over in this industry.
    Personally, I’m okay if people tell me that my code sucks if they can explain why (since I put so much effort into making it not suck, including learning from others’ code for better ways to do things, reading up on ideas for going in new directions, and simply learning new and better ways to do things in this ever-changing industry.)

    • David Woodhouse

      Perhaps I was overly modest. I enjoy coding, to the point that I jest about living in fear that some day I might have to get a *real* job, rather than just being paid for what I would otherwise be doing anyway. And mostly my code *doesn’t* suck by the time anyone gets to see it. The odds are, you’re using some of my code today. If you cared to, you could easily search and *find* plenty of my code. That wasn’t really the point of my comment.

      The point was that *when* my code sucks, I expect to be treated like an adult, not a child. I *detest* the way the kindergarten contingent try to prevent people from interacting honestly and directly at work like *adults*.

      You may not want to hire me because of *that*… but that’s fine; I’m not looking for a new sponsor for my hobby right now. And at least you’d be making the decision for the right reason… not to mention the fact that if you *did* make the decision for that reason, I would probably agree that I don’t want to work for you either ☺

  5. Bonnie B

    Junior developers/engineers need Senior leadership. This is how you develop talent.
    1). Developers need feedback (reviews) on their code
    2). Emotion has no business within this process
    In today’s business world, time is money, and there’s never enough time.