A guy reviewing my first pull request told me my variable names were 'like reading a ransom note,' and honestly he was right | Coding For Beginners - Thought Shares
A guy reviewing my first pull request told me my variable names were 'like reading a ransom note,' and honestly he was right
About a year ago I posted my first real Python script in a beginner group and a guy named Dev left a comment that stuck with me. He said my variables looked like a ransom note, stuff like x, x2, ttl, and a lone p. I got mad at first since the code actually worked fine on my end. But two weeks later I came back to add one feature and spent 40 minutes just figuring out what x2 even held, so I renamed everything to stuff like item_total and user_name. Now I write the names first in plain words before I type any logic, and I catch way more mistakes before running anything. Anyone else get a rough comment early on that turned out to be totally fair?
Naming stuff in plain words before writing logic is the move. Fixes half your bugs before they exist. The ransom note thing is funny but also brutal, Dev knew what he was doing.