24 November 2007

The Code Sucks, Not The Author

by mo

One of the few things I’ve learned in the last few weeks is to not be so politically correct when it comes to sifting through code. What I mean is, if you spot a piece of code that can be improved, then improve it.

Don’t hold back your comments because you’re worried that the author of the code will feel attacked or hurt. There are constructive ways of doing this. If your intentions are to make someone else look bad or prove that you’re a better developer then everyone else, then you’ve got some character flaws that probably need addressing.

If you spot code that smells deal with it. Explain why it smells and construct ways to improve it. Pull request reviews are a great opportunity to do this. You’re not helping anyone by holding back your true thoughts. Your team will get better if you create a culture of offering feedback.

With continuous feedback you might start to notice the light bulb turn on in your team mates minds.

It’s not as valuable if only you can see why a certain piece of code smells. It’s important for the team to see it too.

Most developers try to put out the best possible code that they can. They want to deliver value, so if you spot a better way that someone can do that, show them.

It’s the code that sucks, not the author.