In case you’re lucky enough to work in a team with smart developers, you should establish something super useful: Code reviews.
When reviewing your co-worker’s code please try to keep in mind:
- Understand motivation
- Use proper wording
I know you like to assume that you have great ideas and you probably HAVE a lot of good ideas. But please don’t think of your solution as the only way. There’s always more than one way. When reviewing code, keep in mind that your co-worker has the right to choose any path he wants as long as it conforms to your coding style guide. It’s not your job, enforcing your way of thinking. It’s your task to compare both of your ideas and compare significant differences. If you think that your solution is better, provide evidence by benchmarking your suggestions. Once you are sure about your arguments, approach your co-worker in a respectful way.
Use proper wording
With github you can and should make use of the excellent feature that every line of code can be annotated with comments. When you choose your words, explain why or what you’d do things differently instead of just saying that you would do it differently. Stay productive and keep to the facts. Use a respectful way of talking to each other just as you would do it in real life. Make sure you still like each other after the code review. We humans like positive feedback from time to time. Express the parts that you honestly like about your co-workers work. It will come back - be sure about it.
Be proactive about direct communication
As handy as tools like github come, please do not underestimate the power of having a good old direct conversation. To communicate clearly and openly should be among the skills of every professional developer. IMO it’s as important, if not more important, than writing code. Whenever you don’t understand a particular sequence of code, approach your co-worker directly before wasting time formulating comments. I myself experienced many times, that additional information can clear things up. There is no need for further discussion. Emphasize the last point even more, when you’re sitting together in the same office.
Code reviews are essential. As in email, chat, and any other medium - keep a good style.
When work is involved, people are very vulnerable. Most developers put their heart and soul into their job. Meet on eye level and learn from each other. Happy reviewing!