Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Drawbacks of AOP

Tim says:
> ... came across an issue that I think needs addressing.
> 
> ... The problem is that a programmer looking over some code
> may not realize that the code is cut by an Aspect.  He may
> copy the code into another method and the code may or may not 
> work the same depending on how the pointcut is defined. Or he
> may make a change to the code not fully realizing the impact
> of the change because of the pointcut.

This is an important issue, and one that many people raise when
they look at AOP.

I usually say that proper tool support can go a long way towards
addressing these issues.  The AspectJ support for Eclipse for
example is a great help to programmers with these issues.

One way to think about it is to consider trying to write an
ordinary Java program with no tool support at all.  You can
do it of course, but its hard.  Good tool support lets you
know what methods you can call on an object.  It lets you know
whether a method is overridden or not.  It lets you know, if
you copy a method to another class, whether the this calls
(aka self calls) the method makes will work.

The issues with AOP are fundamentally the same.  Good tool
support lets you know, when you look at some code, that there
is advice on it.  If you copy the code, this reminder helps
you decide whether you want to update the advice or not.  In
future releases of the AspectJ IDE support, things like
refactorings will even offer to automatically update advice.

The tool support doesn't mean that there are no issues, or that
you can edit AOP code without paying attention at all.  But what
is true is that the issues involved are very similar to those
with method calls, and tool support similar to what helps with
OO helps a lot with AOP.

If possible, I would suggest you include some slides and/or
demos of tool support when you explain AOP to people.  Usually
when people see the concrete ways that the tools help people
understand their code, many of these concerns go away.






Back to the top