My best code review experience?

Company hired a new department manager and one of his duties was to get familiar with the code base, so he started rounds of code reviews.
We had our own coding standards (naming, indentation, etc..etc) and for the most part, all of our code would pass those standards 100%.

One review of my code was particularly brutal. I though it was perfect. In-line documentation, indentation, followed naming standards..everything. 'Tom' kept wanting to know the 'Why?'

Tom: 'This method where it validates the amount must be under 30. Why 30? Why is it hard-coded and not a parameter?'
<skip what it seemed like 50 more 'Why...?' questions>
Me: "I don't remember. I wrote that 2 years ago."
Tom: "I don't care if you wrote it yesterday. I have pages of code I want you to verify the values and answer 'Why?' to all of them. Look at this one..."

'Tom' was a bit of a hard-ass, but wow, did I learn A LOT. Coding standards are nice, but he explained understanding the 'What' is what we are paid for. Coders can do the "What" in their sleep. Good developers can read and understand code regardless of a coding standard and the mediocre developers use standards as a crutch (or worse, used as a weapon against others). Great developers understand the 'Why?'.

Now I ask 'Why?' a lot. Gotten my fair share of "I'm gonna punch you in the face" looks during a code review, but being able to answer the 'Why?' solidifies the team with the goals of the project.

  • 4
    Sometimes the "Why" can be annoying as fuck because there might be 10 ways to do something and you picked the one you did "Just Because".

    But yes, in general I agree that the "Why" is far more important than the "What", because half the time the "What" is wrong and if the "Why" is lost then nobody remembers why the "What" exists
  • 1
    nice plot twist tho
  • 1
    I never ever cared about why ๐Ÿ˜”
  • 1

    'Just because' is an accept response. As we've learned, the culture of 'Why?' can also be used as a weapon. Left or right, up or down, if it doesn't matter, the 'Why?' doesn't matter.
Add Comment