News for hackers. Stuff that matters.
Re:Why I Like The Verbosity of Java by samirahmed on Wednesday January 04, 2012 @09:24AM (#3424209)
I agree with the argument that more detail is conveyed in its verbosity.

But I fail to understand how type inference (like that seen in Scala, C# etc... doesn't clean up the verbose)

for example,

    HashMap<String,ArrayList<String>> map =  new HashMap<String,ArrayList<String>> (); 
versus

     val map = new HashMap<String,ArrayList<String>> ();

The latter conveys just as much information
Re:Why I Like The Verbosity of Java by MatthewPhillips on Wednesday January 04, 2012 @09:26AM (#3424216)
Yes but

  val map = GetMap();
does not.
Re:Why I Like The Verbosity of Java by samirahmed on Wednesday January 04, 2012 @09:56AM (#3424320)
As the programmer, you wouldn't call getMap if you didn't know the return type

As the reader, this situation would be analogous to looking up the what map is, assuming it was declared earlier ... is a datamember etc. something that might as well arise when typing..

     private HashMap<Integer, String> map ;
then 30 lines later

     this.map = getMap();

You would have to check javadocs or function header some time
Re:Why I Like The Verbosity of Java by AndrewDucker on Wednesday January 04, 2012 @09:39AM (#3424255)
It does when you can hover your cursor over GetMap() and see the exact specification for it.
Re:Why I Like The Verbosity of Java by coopernurse on Wednesday January 04, 2012 @09:44AM (#3424273)
Agreed. Once you use a language with type inference it's hard to go back to Java.

Java also lacks properties, which results in boilerplate getter/setters if you want to follow idiomatic convention (you could make all the member variables public, but your coworkers would probably shun you).

Re:Why I Like The Verbosity of Java by benjiweber on Wednesday January 04, 2012 @06:36PM (#3426527)
There are alternatives. e.g. a public final Property<String> Name = new Property<String>();

Where Property defines a .get() and a .set();

However, getters and setters are generally a code smell. It's better to be telling objects to do things rather than ask them for information. Modern Serialization & Injection frameworks no longer require getters/setters.

Re:Why I Like The Verbosity of Java by benjiweber on Wednesday January 04, 2012 @06:34PM (#3426518)
You can now do

HashMap<String,ArrayList<String>> map = new HashMap<>();

in Java 7 http://docs.oracle.com/javase/tutorial/java/generics/gentype...