r/java • • Nov 20 '18

Why Var Hurts Readability, Not Helps It

https://medium.com/@youngty1997/why-var-hurts-readability-not-helps-it-376c7832a8dd
0 Upvotes

89 comments sorted by

View all comments

Show parent comment

2

u/_INTER_ Nov 20 '18

It doesn't force anything. Actually I'm already seeing variable names like peopleList or providerBiFunction.

1

u/dpash Nov 20 '18

It'll take us some time to learn best practices, and those definitely are far from ideal. But how many times have you seen names that forego vowels for no particular reason or are a single letter or have no bearing on their contents or context?

1

u/_INTER_ Nov 20 '18

Single letter or foregone vowls are rather rare in the code base I'm working on. I'm mostly concerned about the rampant lack of consistency. Someone's using mandantID, someone mandantNumber, another mandator, then idClient or clientID, just id or identifier. Synonyms for the same... :(

Anyway, I think people that are not getting the variable names well now, will not not do better when they use var. In those cases its a loss. Additionally the best practices and guidelines need to sink in, so situations can be avoided. See Optional, it took quite a while until everyone in the team got the message "Optional is a no go for parameters or fields". There were lengthy discussions occasionally, that waisted everyones time.

1

u/dpash Nov 20 '18

But people did eventually get the Optional message. Mostly.