Re: Terminolgy: the verb corresponding to "toString"
Roedy Green wrote:
It is also behind my complaint with code of the form
HashMap<String,ThingAMaJig> thingamajigs
= new( HashMap<String,ThingAMaJig>( THINGAJIG_CAPACITY );
^
The type of thingamajigs should be specified in only one place.
It requires proofreading to make sure both sides stay identical.
Which, fortunately, the compiler does for you.
Anyway, the usual pattern is
Map<String,ThingAMaJig> thingamajigs
= new HashMap<String,ThingAMaJig>( THINGAJIG_CAPACITY );
which is less "redundant".
It is also behind my complaint with code of this form:
Short s = (short)someFile.length();
The fact that s is short should be specified in only one place.
Which would cause trouble with narrowing conversions. The cast is not redundant.
It is ridiculous to be a lazy code writer and have to be a hard-working code
maintainer. The effort should be on the writing side to minimize the effort
on the maintenance side. These so-called "redundant" idioms add safety and
documentation to the code.
If you want terse, dangerous code, don't use Java. Use Javascript or PHP or
something. For professional, robust code with lots of compile-time checking,
use Java and get over your laziness.
--
Lew