Re:Java finally getting closures, method handles and traits ...
by Jach on Monday January 24, 2011 @02:48AM
(#2134615)
Oh come on, it's not that ridiculous to have a map only 4 levels deep. (Though I'll admit the code there is a patch-job over a much worse design that will all be refactored one day...) It's just ridiculous to express in Java. JavaScript's pretty much built on the idea of nested objects/maps.
[ Parent
| on HN ]
Re:Java finally getting closures, method handles and traits ...
by nevster on Tuesday January 25, 2011 @01:34AM
(#2138275)
That's fine. My point is, it's extremely uncommon to come across this kind of structure in Java-land. Typically, there'd be separate classes for these objects - so you'd end up with a Panel class with fields width, height, title, renderTo and items. Items would be another class with it's subsequent fields. And so on with no maps in sight.
You're example Java declaration doesn't seem to actually capture the Javascript code you've got there - ie each initial string does not map to another Map - in some cases it just maps to an integer or string.
By the way - I totally agree that the declarations of stuff in Java with generics is way too verbose.