Stop me if you heard this one. You have written a hundred lines of code. You pass it off to a code reviewer. He tears it to ribbons.
He tells you to restructure some conditionals. He tells you that an algorithm would be better written another way. He tells you to use different classes than the ones you are using.
Then you ask him if he knows what the code does. And he doesn't.
As autistic coders, we are rarely so bold as to challenge the reviewer about his knowledge of what our code does, and we rarely ask this simple question.
But we should.
And, when you are reviewing someone else's code, you should be asking the same thing to yourself: 'What is the purpose of this code?'
Above all else, a code review should be used to determine if you have written understandable code. Given the comments, given the structure of the code, given the flow of control, are you able to say back to the coder what his code does?
If you can't, then one of two things is true:
- The code fails the review
- The code reviewer fails the review