Hi everybody
Those code blocks are really nice
Very nice indeed...
But anyway, they are usefull not because they are elegant, but because
they capture the context in which they are created. In Java only
variables declared <final> will be captured by an annonymous class, so
if you want some variable in the current context, you can do something
like this:
I pay the bills working as architect (but with plenty coding and field
work) in a java shop.
Thinking in blocks and closures really helps to avoid repeating
collections traversals and analisys ad-nauseam. Closures as anonymous
or inner classes keep the code simpler, making clearer what are you
doing, not how. It makes also easier the reuse of common blocks as
full classes.
We usually use jakarta commons [1]. It provides the basic interfaces
for typical functors (closure, predicate and transformer) and
collection traversal and processing functions.
Not the ideal package, but enough for our needs (and zero time
provided to implement or evaluate alternatives 8'( ).
The concept is very easy to sell to upper echelons and to developers
(it pays fast).
The only real price is more verbosity compared with Ruby.
Final variables are not a problem, as we try to make final everything
that musn't be non-final.
Groovy looks good, and it is (much) faster that Ruby (from my own
personal experience) but it is still too young, and although it's a
JSR, it's programmers only work on their free time on it, so we will
have to wait, and to be honest, right now the future does not look very
bright for Groovy (it's only my oppinion, and I hope I'm wrong).
I would like to have the time for a beanshell vs. groovy comparation...
[1] Collections – Home
Just my two cents.
···
On 06/09/05, bonefry <bellarchitects@gmail.com> wrote:
--
Saludos mercenarios...
A los vampiros no les gusta el sol
y yo, como es normal, no soy una excepción.
Llegó el verano, llegó el verano...