H
10

Why nobody talks about getting roasted in code reviews for variable names

My first week at a small dev shop in Austin, a senior guy named Mark flagged my pull request and said 'what is 'temp2' supposed to mean? I need a whole novel to figure it out.' He had a point (even though it stung). I started using names like 'userEmail' or 'remainingCount' instead of 'x' or 'temp1' and my mistakes dropped by like 40 percent. Has anyone else had a code review comment that totally shifted how you write?
2 comments

Log in to join the discussion

Log In
2 Comments
rowank69
rowank695d ago
Mark the senior dev at my first gig made me rename 'data2' and I still think about that lesson every time I type a variable.
0
wren_smith44
Was it just the name that bothered him or was there a bigger reason behind it? Like was the variable doing too much or did the name not match what it actually held? I had a senior once who made me change a boolean because it was named after what the function did instead of what the data was, and that stuck with me way more than any style guide ever did.
8