MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/49prtn/var_keyword_proposed_for_java/d0urql2/?context=3
r/programming • u/adila01 • Mar 09 '16
395 comments sorted by
View all comments
2
It seems that Java developers don't really understand why it is very useful.Regardless of how much the IDE can help with intellisense/type, having this var is an amazing feature that simplifies the code clutter.
var
1 u/Carighan Mar 11 '16 By requiring me to hover over variables to find out their type? 1 u/stun Mar 14 '16 edited Mar 14 '16 By the time you scroll down, you don't know what type it is anyway.You mouse-hover it to see its type at that point regardless.If you can see the variable declaration, there is no need to mouse-hover.Consider the following declarations.Which do you think is easier to read/scan?var dictPeople = new Dictionary<int, People>(); var listPeople = new List<People>(); var peopleListByDept = new Dictionary<int, List<People>>();vsDictionary<int, People> dictPeople = new Dictionary<int, People>(); List<People> listPeople = new List<People>(); Dictionary<int, List<People>> peopleListByDept = new Dictionary<int, List<People>>();
1
By requiring me to hover over variables to find out their type?
1 u/stun Mar 14 '16 edited Mar 14 '16 By the time you scroll down, you don't know what type it is anyway.You mouse-hover it to see its type at that point regardless.If you can see the variable declaration, there is no need to mouse-hover.Consider the following declarations.Which do you think is easier to read/scan?var dictPeople = new Dictionary<int, People>(); var listPeople = new List<People>(); var peopleListByDept = new Dictionary<int, List<People>>();vsDictionary<int, People> dictPeople = new Dictionary<int, People>(); List<People> listPeople = new List<People>(); Dictionary<int, List<People>> peopleListByDept = new Dictionary<int, List<People>>();
By the time you scroll down, you don't know what type it is anyway.You mouse-hover it to see its type at that point regardless.
If you can see the variable declaration, there is no need to mouse-hover.
Consider the following declarations.Which do you think is easier to read/scan?
var dictPeople = new Dictionary<int, People>(); var listPeople = new List<People>(); var peopleListByDept = new Dictionary<int, List<People>>();
vs
Dictionary<int, People> dictPeople = new Dictionary<int, People>(); List<People> listPeople = new List<People>(); Dictionary<int, List<People>> peopleListByDept = new Dictionary<int, List<People>>();
2
u/stun Mar 10 '16
It seems that Java developers don't really understand why it is very useful.
Regardless of how much the IDE can help with intellisense/type, having this
varis an amazing feature that simplifies the code clutter.