Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Any useful examples

On Fri, 2003-08-08 at 03:54, Kenworthy, Edward (EDS) wrote:
> Been following Aspects for a year/18 months but never really dived in,
> principally because I still don't see the point ;-)
> 
> Sure they're useful for adding logging (but that's only one thing), I can
> see that, but many of the other examples (eg strapping on a UI) would be
> better solved using other techniques (eg patterns, MVC etc). Anyone have, or
> can point me at, an example of a non-trivial application of aspects that
> either couldn't be solved another way, or is much, much easier solved using
> aspects ? The example doesn't need to be complex, but what it's doing should
> be non-trivial (if you see what I mean).

At an abstract level: if you need to make some changes to an app, but
you are unwilling/unable to change the source code of that app, then
using aspects to implement the glue between the app and the changes you
want to implement can be quite helpful. Alternatively, if you are
providing a toolkit for others to use, but you don't want to impact
their work too much, it's also helpful.

Concretely: I'm working (slowly) on recording and playback of eclipse
itself. I'm using aspects to add all the listeners to all the widgets so
I can capture all the user's events and log them to a transcript, and I
really don't want to implement SWT itself, or change all the code in
Eclipse. That would be a maintenance nightmare.

Alternatively, if I wanted to give someone a toolkit that provides
logging and replay, I would rather give them the aspects that provide
(at least) the logging rather than forcing them to use my API which
would encapsulate the constructors for every widget in the system.

Granted, this is still a form of logging (though not quite, because it's
actually adding a set of listeners after any constructor is called), but
I think the abstract concept should apply to other concrete problems.

mike

> 
> Thanks in advance.
> 
> Edward
> 
> PS
> 
> I've downloaded the examples and faq, and (maybe I'm not seeing the wood for
> the trees) but I couldn't see such an example there.


-- 
Michael R Head <burner@xxxxxxxxxxx>
ZClipse -- OpenSource Eclipse plugins



Back to the top