>
> It's just a two-liner in Java instead of a one-liner like in Ruby.  I 
> don't know where you and Devin are getting this idea that you need to 
> "make extensive use of the Reflection API" and a "load of reflection 
> trickery" to write polymorph or similar kinds of things in Java.  Here 
> it is, and I think it's very straightforward, if a bit more verbose 
> than the equivalent Ruby code:
>
> Object polymorph(Object snufkin) throws Exception {
>   Method m = snufkin.getClass().getMethod("foo", null);
>   return m.invoke(snufkin, null);
> }
>
I was thinking of a slightly more complicated example where I had to 
write some code that would find a method named by a parameter, rather 
than having a hardcoded method.  Looking at this code I realize I could 
optimize my code a wee bit (remove 1 line).  I've been coding Java for a 
few years now and one of my favourite parts is the reflection API, but 
as Java is staticly typed it does make some things hard to do (although 
most of the time if you're doing those things then you've chosen the 
wrong strategy in the first place).

 From my current point of view, I have to compare Ruby to Java (and I 
suppose C) as they are the only two mainstream languages (except various 
SQL dialects) that I've spent any considerable time coding in and give 
me a good basis for comparison.  So yes I'm comparing a dynamic language 
with a static language and finding that the dynamic language has 
advantages in certain circumstances.

Also (again very pesonally, could be miles off here), I think that there 
is a revolution around the corner, with dynamic languages coming more to 
the fore of mainstream programming.  I look back at what Java did (a lot 
that was good), javadoc (spawned a lot of other code documentation 
tools), vm design, no pointers, safe code, sandbox for applets, unit 
testing (ok Junit), broke programmers away from the IDE (yay Ant!).  I'm 
at the point where I'm looking at Java and thinking about it in the 
past, ie I don't see anything innovative coming from Java in the future 
Java5 did it for me, I didn't find anything compelling in it, just a "me 
too" shout at C#.

So at work I hack out code for server apps using opensource frameworks 
etc and I code all day in Java and yeah it's comfortable (like a 
well-worn bathrobe), but it's a bit long in the tooth and I'm looking to 
learn something else and see what else is around.  Does this mean that I 
bash Java at every opportunity?  Nope, but I don't see it as the 
innovative language where the new stuff is coming from any more.  And 
maybe my post about polymorphic trickery was off-tack as a: I'm crap at 
Java, or b: I didn't think it through properly before posting.

Kev