[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: accumulator generator (Java)
> The product that I've been contributing to for the last couple of
> years is written in Java and based on an XML DBMS. We do exactly what
> you're talking about. It's true that you have to add some "final"
> declarations, and sometimes it would have been nice if you could have
> modified variables in the containing block, but even in light of this
> problems, we'd never consider doing without this! It's extremely
> important to centralize that behavior, which has many subtle
> aspects that needed very careful design and debugging.
I probably overstated the problems with the approach. PaulG's example that
I was addressing was one case where you run into the mutability issue, and
it reminded me of other such problems that I've had. However, I do still
use this idiom, although probably not as much as I should. Part of it is
that I haven't tried very hard to convince my clients to use it, so a lot of
the code I work with doesn't use it.
Lately, I've been considering doing this kind of thing with a tool like
AspectJ or perhaps the one Avi recently mentioned, Elide (which sounds as
though it may be much more dangerous and therefore appealing :) I have the
feeling that these tools could handle the problem more cleanly, but I
haven't had a chance to try them seriously yet.
> Annoyances, yes, but in practice pretty tolerable.
Java in a nutshell ;o)
Anton