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

13

u/Sipkab Nov 20 '18

It's the responsibility of the developer to not abuse language features.

For myself, I'm not a big fan of var, but I can see some useful use-cases. (First that comes to mind is declaring iterator variable in a for loop.)

6

u/[deleted] Nov 20 '18

[removed] — view removed comment

1

u/AndDontCallMePammy Nov 22 '18

It is impossible to "abuse" the variable naming feature. Any code will behave exactly the same regardless of the variable name.

String inaholeinthegroundtherelivedahobbitNotanastydirtywetholefilledwiththeendsofwormsandanoozysmellnoryetadrybaresandyholewithnothinginittositdownonortoeatitwasahobbitholeandthatmeanscomfort = getSentence();