There is a better way to implement X

One of the code reviews comments that I’ve been seeing recently is “There is a better way to do this” and without further explanation.

By far this is one of the killer comments you can leave to someone. It is not only telling the coder that his code is not the best. but also leaving him with two challenging questions.

  • What is wrong about this implementation?
  • What are those better ways?

My advice to any reviewer who writes such comment, Try to write a more constructive review. One of the goals of code review is to identify the problems in the code and propose better ideas for implementation. so If you see something that is not at its best. Identify why it is not. and what are the better ways to implements it? always give the requestor something to learn, and go home with.

And If you are requesting a review then received this comment, don’t be defensive about your code. just take a deep breath, and ask the 2 questions above.

Leave a Reply

Notify of