|
From: Vincent M. <vm...@oc...> - 2001-08-20 13:08:26
|
I have discovered AOP this week end (AspectJ) and found it very very interesting, especially for unit testing purposes. I highly suggest that you take 30 minutes to an hour to read the "getting started" paper (http://aspectj.org/doc/gettingStarted/index.html). I find the idea great. In a few words, the idea is that there exist some crosscutting aspects (hence the name: AspectJ) that encompasses several methods. For example, let's say you want to log the entry and exits of methods. This is a general pattern. In java, it would be very difficult to materialize this aspect. You would have to add log statements at the beginning and end of each method, but still you would not have captured the pattern. Also, if you add a new method, you have to remember to add log statements. AspectJ let you describe aspects in its own semantic (near java). Then, you apply the aspect compiler which will transform the code in java and invoke the javac compiler to compile it. It is very very powerful. You can say things like verify that such method is only called by such other method when it is in such context. There are better examples (with code) given in the paper highlighted above. Just wanted to let you know -Vincent |