Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Patterns of pointcuts


I reached the same requirement by define abstract pointcut for "captures join points for semantic event E" and implementing concrete pointcuts for each team packages.

You may want try this out.

Bo
----------------------------------------------------------
 Dr. Bo Yi
 WebSphere Development & Testing
 IBM Toronto Lab
 A2-713/Q2Z/8200/MKM
 8200 Warden Ave. Markham ONT. L6G 1C7
 Phone: 905-413-4819
 Tie Line: 969-4819
 E-Mail: boyi@xxxxxxxxxx



Nathan McEachen <nathan@xxxxxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

11/08/2005 08:45 PM

Please respond to
aspectj-users

To
aspectj-users@xxxxxxxxxxx
cc
Subject
[aspectj-users] Patterns of pointcuts





My understanding is that if I want to define a pointcut in terms of
other pointcuts, I need to enumerate them:

   pointcut somepointcut() : p1() || p2() || p3();

I am thinking it would be nice to define a pointcut in terms of other
pointcuts by using a pattern (I am pretty sure you cannot do this)  Example:

   pointcut somepointcut() : p*();

Here is my rationale:

I am envisioning a large project with many teams of developers.  Each
team defines a pointcut to represent a given semantic event (e.g. a
transaction) as implemented in their respective modules.

   p1() captures join points for semantic event E as implemented in
package1 by team 1
   p2() captures join points for semantic event E as implemented in
package2 by team 2
   p3() captures join points for semantic event E as implemented in
package3 by team 3
   etc..

Each team does not know the implementation details of event E in the
other packages.  In a large project, the cognitive burden of the
implementation details of event E across the entire project may prove
too great for a single person.

In order to weave advice for event E across the entire project, such
advice would have to reference some pointcut pg() (g for global) that
included p1(), p2(), and p3():

   pointcut pg() : p1() || p2() || p3();

So far so good.  But what if a 4th package were added to the project
written by a 4th team?  An additional pointcut, p4() would need to be
created, plus pointcut pg() would need to be updated to include it.

Wouldn't it be nice if we could add additional such packages and not
have to maintain the definition of pg()?

   pointcut pg() : p*();

Is there a way to define a pointcut in terms of other pointcuts without
explicitly enumerating them?  If not, then do you agree/disagree with
the usefulness of having such a feature?


Thanks in advance for your thoughts,

-Nathan

--
In theory, there is no difference between theory and practice.  But, in practice, there is.

--Jan L.A. van de Snepscheut


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top