Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Philosophical Questions

Title: Message
Gregor,
 
Just so I understand your terminology: property-based pointcuts involve selection via marker interface and enumeration-based pointcuts involve explicit class patterns?
 
This is an interesting change in view. My impression from following AspectJ lists before is that metadata and even static inner aspects are still the same close coupling we had before, only adjacent to the mainline code instead of embedded within it. Is this just a measure of practicality, or is there some real benefit to highlighting aspects directly in Java classes? I can certainly see it easing the transition for developers, but I'm worried that it can get out of control quickly. If you look at the .NET metadata usage for XML binding, for example, there are so many metadata tags that it distracts from the underlying code.
 
Cheers,
 
Merrick
 
 
-----Original Message-----
From: Gregor Kiczales [mailto:gregor@xxxxxxxxx]
Sent: Monday, July 07, 2003 1:54 PM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] Philosophical Questions

 

From    Merrick Schincariol
Sent: Saturday, July 05, 2003 8:03 AM

1) Can Aspects themselves be broken down into smaller sub-components?
  
 
 Most of the Java AOP frameworks break out aspects into a number of different pieces. For example, you implement your advice as one Java class, your introductions as another and then define (usually using XML) the pointcuts and the relationships between the components. So one Aspect could actually require many files to implement and define. Does the complexity of this approach interfere with the AOP philosophy? My fear is that when the implementation requirements are complex, from a language point of view, you start to lose track of the problem you are actually trying to solve. 
 
 2) Can pointcuts be modeled separately from advice?  
 
This follows on the above point, but it's one that I find a little odd. Most (all?) of the pure Java approaches define their pointcuts in one file and their advice in another. Presumably this means that advice can be reused across multiple different aspect definitions. From a philosophical point of view, can advice be modeled truly independently from pointcuts? I would think that certain types of advice, particularly when dealing with cflow and other advanced join points, really require the pointcut definition to be present in order to make sense. 
One of the guiding principles of the AspectJ design was that we were trying to enable modular implementation of crosscutting concerns -- aka aspects. That is what led us to put pointcuts, advice and other member declarations together into aspects. For example, being able to see the entire ObserverProtocol aspect in a single screenful of code was important to us.  It gave us the nice modularity we were after. I personally believe that is critical, that's what separation of concerns is about, getting the concerns into separate modular pieces.
 
From that perspective, putting pointcuts and advice bodies in separate files isn't what we want.
 
But what I don't understand is to what degree tool support will be able to bring the separate things back together. One of the claims about XML and meta-data is that of course you'll never edit the raw meta-data or XML, there will be tool support. If there is tool support, then that support might be able to make things look more modular. But then again, everytime I see someone talking about XML they insist on showing me the raw XML, so I'm not sure how present the tool support is.

 3) What role, if any, should metadata play in AOP?

I know Gregor has commented on the use of metadata a couple of times, but the JBoss group is charging ahead with their "AOP" product which encourages developers to use class metadata to load library aspects. This strikes me as wrong in many ways, but the message that is reaching the development community is that interceptors and metadata are all you need to do AOP. Is this just a function of what's easy to implement, or are people really having trouble grasping the concepts? 

 My opinion on this has softened. I now believe that meta-data support (ala JSR-175) is useful, and that when it appears in Java, tools like AspectJ should support it instantly. I think programmers should use attributes (aka tags or metadata) in pointcuts in certain circumstances when property-based or enumeration based pointcuts are not appropriate. Without going into detail, I think the 3 cases are:
 
  - if the pointcut reaches a large number of join points, use a property based pointcut
 
  - if the pointcut reaches a small number of join points, and a property-based pointcut is hard to write, use tags
 
  - if the pointcut reaches a small number of join points, and a property-based pointcut is hard to write, and you don't have access to the target source, then use an enumeration-based pointcut.
 

Back to the top