A guy in my Python study group told me my variable names 'looked like a ransom note' and I finally fixed my code | Coding For Beginners - Thought Shares
A guy in my Python study group told me my variable names 'looked like a ransom note' and I finally fixed my code
About 2 months ago I was working on a little program that tracks my grocery spending, just a basic thing with a list and a loop. I sent it to this guy in our group, Dave, and he wrote back 'dude your variable names look like a ransom note.' I had stuff like x, y, tmp2, and even one called thingy. At first I got kinda annoyed, but then I read my own code a week later and couldn't tell what half of it did. So I went back and changed everything to real words like grocery_total and item_count, and even added short comments on the tricky parts. The crazy part is I found 2 bugs I never noticed before, just because I could finally read what I wrote. Now I spend an extra 5 minutes naming stuff and it saves me hours later. Anyone else get called out like that, and did it actually stick? I'm curious if naming habits are the thing that trips up most new people or if it's something else.