Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Basic Question on Aspects

Peter,

Thanks for the excellent reply.

Sreekanth, For additional examples check:

http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/sample-
code.html?cvsroot=Technology_Project

Also, the two published books on the subject:
''AspectJ in  Action'' by R. Laddad
 http://www.amazon.com/exec/obidos/tg/detail/-/1930110936/
"Mastering AspectJ" by Nicholas Lesiecki http://tinyurl.com/66vf

Also, it's always a good policy to read the FAQ for a project. AspectJ's FAQ
is exceptional and contains enough information to answer this question.

Cheers,
Nick

On 12/1/03 11:17 AM, "Peter Kalmus" <peterlists@xxxxxxxxx> wrote:

> Anytime you're frustrated with a "crosscutting concern" there's an application
> of AspectJ lurking
> somewhere.
> 
> For example, I've used AspectJ to do the following:
> + register GUI components in a GUI testing framework
> + place methods on the "Swing thread" (by using around advice and
> invokeAndWait())
> + add listeners to a new Window, whenever one is created
> 
> And, in addition, there are patterns waiting to be discovered quite apart from
> the usual
> crosscutting concerns.  Below is a recipe which I first saw in ''AspectJ in
> Action'' by R. Laddad
> (apologies if someone else actually thought of it first).  It does address a
> crosscutting concern
> when you think about it, but IMHO it takes on a life of its own.  If this
> doesn't make you go
> "Wow...", then I give up. :)
> 
> -Peter Kalmus
> 
> public interface Nameable {
>   public void setName(String name);
>   public String getName();
> 
>   static aspect DefaultImplementation {
>       private String Nameable._name;
> 
>       public void Nameable.setName(String name) {
>           _name = name;
>       }
> 
>       public String Nameable.getName() {
>           return _name;
>       }
>    }
> }
> 
> An implementation of Nameable:
> 
> public class MyClass implements Nameable {}
> 
> A test of MyClass:
> 
> public class Test {
>   public static void main(String[] argv) {
>       MyClass mc = new MyClass();
>       mc.setName("Bill");
>       System.out.println(mc.getName());
>   }
> }
> 
> 
> 
> 
> --- Sreekanth Vadagiri <SVadagir@xxxxxxxxxxxxxxxx> wrote:
>> 
>> 
>> 
>> 
>> Hi Guys,
>> I apologize if this group is not appropriate for this question. Please let
>> me know if there is a appropriate group i could post this on.
>> 
>> I like the whole concept of aspect but the problem is that it is restricted
>> to a very limited set of problems. The examples that i see all the time is
>> logging, transactions, exceptions handling, session management etc.
>> i am yet to find a different problem to which aspects can be applied. Is
>> there an example of  application of aspects in problems different from the
>> above?
>> 
>> TIA
>> Sreekanth
>> 
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
>> http://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 
> __________________________________
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now
> http://companion.yahoo.com/
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users

-- 
Nicholas Lesiecki
Software Craftsman, specializing in J2EE,
Agile Methods, and aspect-oriented programming

Check out my books:
* Mastering AspectJ: http://tinyurl.com/66vf
* Java Tools for Extreme Programming: http://tinyurl.com/66vt

Check out my articles on AspectJ:
* http://tinyurl.com/66vu and http://tinyurl.com/66vv



Back to the top