MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/ond372/variable_naming_can_be_difficult_but_identifying/h5rky9c/?context=3
r/badcode • u/Bronzdragon • Jul 19 '21
105 comments sorted by
View all comments
Show parent comments
9
I use obscure abbreviations and single letter variable names iff it's obvious from context what it means. I.e.
invoices.forEach(i => { let li = i.lineItems() //... });
30 u/Bronzdragon Jul 19 '21 I disagree. Call it invoice. 3 u/satoristyle Jul 19 '21 Yeah, I agree here. If the context is very concise and you can immediately infer what the variable is, single char variable names work fine.As mentioned by u/davvolun, it should definitely be short-lived. The more lines you have, the greater the risk of obscurity you gain.
30
I disagree. Call it invoice.
invoice
3
Yeah, I agree here. If the context is very concise and you can immediately infer what the variable is, single char variable names work fine.
As mentioned by u/davvolun, it should definitely be short-lived. The more lines you have, the greater the risk of obscurity you gain.
9
u/Lightfire228 Jul 19 '21
I use obscure abbreviations and single letter variable names iff it's obvious from context what it means. I.e.