5 ms·
This is a good point. I personally find the "code compactness" to be a bit of a red herring. Java's greatest weakness, after all, is not the verbosity per se.
by doktrin 14y ago
This is a good point.
I personally find the "code compactness" to be a bit of a red herring. Java's greatest weakness, after all, is not the verbosity per se. If all of its other failings were addressed I would probably scarcely care about the amount of code it takes to perform a given task.
Likewise, compactness is not what lies behind the current FP trend. Compactness, after all, while related to programming paradigms is more directly tied to the strength and level of abstraction afforded by a given library / API. Ruby's standard library, for instance, allows for some pretty insane one liners.
This is to say nothing of the development time overhead involved in switching paradigms (non-trivial, IMHO). This alone offsets "compactness", both from the standpoint of up front dev time as well as readability / correctness, for (IMO) up to half a year.
As an aside, that code could be made yet more compact if written in Groovy (Groovy-as-a-Java-superset and not functional Groovy, necessarily).
- zmmmmm 14y ago> that code could be made yet more compact if written in Groovy Indeed. It's very hard to read this and not think ... "but this would just be" in Groovy: [m1,m2]*.keySet().sum().sort().join(",")?:"<none>" So small that I would rarely even make a separate function for it. I imagine it's much the same in many dynamic languages.