G
12

Got roasted for my variable names and it actually helped

I was posting my first little Python project (a simple calculator) on a feedback thread and someone said my variable names like 'x' and 'y2' made the code unreadable. They told me to pretend someone else had to fix my bugs at 3am, so I changed everything to 'user_input' and 'total_result' instead. Anyone else get hit with a code review that stung at first but really clicked later?
1 comments

Log in to join the discussion

Log In
1 Comment
white.grant
Little correction though - your original names weren't wrong (x and y2 work fine for math), but the big improvement is making the code tell a story so you don't have to guess what each piece does. That 3am bug fix mental trick is gold, I started doing it after a similar review and it changed how I name everything. The sting fades fast once you realize they were just trying to save you from future headaches with your own code.
3