Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Aspect Oriented Programming (AOP): Using AspectJ to implement and enforce coding standards

On Fri, Jan 24, 2003 at 08:37:49AM -0500, R. Dale Asberry wrote:
> Also, I'm currently working on an article to show how to use aspects to
> implement/enforce design patterns.  If anyone has any work they'd like to
> contribute, it would be much appreciated!

Jan Hannemann and Gregor Kiczales at UBC have implemented the 23
Gang-of-Four patterns in Java and AspectJ and written a paper (presented at
OOPSLA 2002) reporting their results.  Their code and paper are at:

http://www.cs.ubc.ca/~jan/AODPs/

I personally think AOP has the potential to be very valuable in expressing
design patterns, and could be an important step toward allowing composition
of software components in richer patterns than traditional component-based
systems allow.  There are some excellent examples in this paper, most
notably the Observer pattern.

However, I am not entirely convinced by the implementations presented in
this paper.  For example, I don't see why the State and Strategy patterns
exhibit differening levels of improvement when comparing an AspectJ
implementation to a Java one.  The patterns have exactly the same structure.
For an added kick, try to implement a reusable Singleton aspect that uses a
getInstance() method rather than around() advice on constructors.  You will
probably find yourself wishing AspectJ had generics, or perhaps you will use
a very clever reflection-based workaround that I haven't quite fleshed out.
Interesting puzzle.

shimon.


Back to the top