[aosd-discuss] Re: Looking for AOP implementation...
Eric.Jain at isb-sib.ch
Wed Mar 12 15:16:18 EST 2003
> it might help if you explained what it is you are trying to do.
I was writing code for instantiating and populating predefined objects
from a stream of RDF statements. At some point I discovered that I need
to create and hand off some objects even before I know their exact type.
I can be reasonably sure that no operations will be invoked on those
objects until I get to 'set' their exact subclass.
// <zoo> <hasAnimal> <x>
// <x> <rdf:type> <dog>
((AspectClass) animal).setTarget(new Dog());
The classical solution (I guess) would be to queue statements that can't
be handled at the moment, but this can get trickier than it sounds, not
to say inefficient. Being able to pretend that an object exists already
simplifies things a lot. Besides, I am always desperately looking for a
way to integrate fashionable technologies into my projects :-)
Seriously, one approach I'd rather avoid is anything involving bytecode
modification a la AspectJ; this simply adds to much complexity (tools
support etc.), and further ensures that none of my collegues will ever
be able to make sense out of my code... (I still believe its a great
tool for adding functionality that can be safely removed from the
system, e.g. debugging and monitoring code)
Also, I have some another issues coming up for which I believe AOP
offers convenient solutions. For example, I need to be able to attach
so-called 'evidence' objects to most of my existing classes (ideally
without having to go and modify each one of them), and to have certain
business objects transparently load themselves, using different
strategies set at runtime. Now if only I could find an implementation
that suits my purposes well...
More information about the discuss