A guy at the Denver meetup told me naming variables x and y was hurting me, so I tried a week of full names | Coding For Beginners - The Design Community Hub
A guy at the Denver meetup told me naming variables x and y was hurting me, so I tried a week of full names
I went to a beginner JavaScript meetup in Denver last month and showed my project to a guy sitting next to me, and he pointed at my loop and said the single letters made it impossible to follow. I spent 5 days renaming everything, so now it's secondsElapsed and itemsRemaining, and reading my own code back is way less painful. How long did it take you folks to break the short name habit?
Funny thing is I used to roll my eyes at the short name thing and figured i and j were fine for loops. Then I went back to code I wrote six months ago and spent ten minutes figuring out what a variable called "t" was even holding. Now it's totalPrice and retryCount, nothing fancy, and I read it twice as fast. Still fine with short names for tiny loops, but anything that lives more than a few lines gets a real name now. Took me maybe a couple weeks before it felt normal instead of slow.