[aosd-discuss] AOP for MVC
Adrian Colyer
adrian_colyer at uk.ibm.com
Wed Apr 20 03:03:10 EST 2005
A few options....
a) use the classic observer pattern and register controllers as observers -
then just have the advice notify them
b) as (a), but instead of hand-coding the observer registration call, use
an aspect (ObserverRegistration ?) that registers any newly created
controller automatically. e.g.
pointcut controllerCreation(Controller c) :
initialization(Controller+.new(..)) && this(c);
after(Controller c) returning : controllerCreation(c) {
// foo.addObserver(c);
// assuming you know what foo is!
}
c) if you don't have a convenient central registration point for
registering controllers as observers (the foo in example b), you could try
moving to a more event-driven architecture based approach. I wrote a simple
example of how that might look here:
http://www.aspectprogrammer.org/blogs/adrian/2005/03/event_driven_ar.html
-- Adrian.
20 April 2005 00:05
To: discuss at aosd.net
cc:
From: Sean Gilbertson <sean-lists at bluebeard.org>
Subject: [aosd-discuss] AOP for MVC
I've been trying out AOP by having it take actions from a controller,
operate on data, and tell the controller how things changed. This has
been fine, but I've run into a problem: when changes occur in the data
(outside of any trigger from the UI), I'm not sure how to let the
controller(s) know that something has happened. Ideally, I'd like to
just have some way to call a method on all classes that implement the
controller's interface (i.e. "executing" a pointcut?), but maybe you
have a better idea?
Thanks,
Sean
__________________________________________________
AOSD Discuss mailing list - discuss at aosd.net
To unsubscribe go to http://aosd.net
More information about the discuss
mailing list