From: wsdng@... (=?ISO-8859-1?Q?Sascha_D=F6rdelmann?=) Date: 2003-08-29T18:58:05+09:00 Subject: Re: Aspect oriented Everything? Aredridel wrote in message news:<1062095301.13334.23.camel@mizar.nbtsc.org>... > > It is only when you run into this kind of situations, that you start > > to think about code factorization in a different dimension. > > Bingo, thank you, Hung Jung! That makes AOP -totally- make sense to > me. I realize I do it already, instinctually, usually with callbacks in > methods -- I'll pass self to a mixin method at the top of the method, > and perhaps later at the bottom, letting me use a ruby mixin as a sort > of kludgy AOP cutpoint. Callback is different. What you do is called template method pattern: http://patterndigest.com/patterns/TemplateMethod.html AOP is indeed very similar to template method. A join point is a means to call a hook functon where no hook function has been defined by the class designer. That's why AOP is said to break encapsulation. AspectJ replaces the hook function by something called advice which I view as a strategy object or functor: http://patterndigest.com/patterns/Strategy.html The whole thing together - combining template method pattern with strategy pattern - is very similar to the visitor pattern: http://patterndigest.com/patterns/Visitor.html So, whenever you need the same visitor on a distinct set of methods (the pointcuts), there you are: use AOP instead! Cheers Sascha