That was just what I needed, thanks.

Btw, in your ruby rewrite, you don't handle one of things the java code
did - NOT doing the permission check before toString(java)/to_s(ruby).

I would summarize what I know so far about aspect-oriented refactoring
by saying:

  it appears to offer a pattern-language for specifying code locations
  (methods, for example, by name and/or class, and by arguments,
  possibly using wildcards), and then saying before/after those methods,
  run "this' code.

  It also seems possible to single out method /calls/, using similar
  patterns, and run code before, after, or in-place of those calls.

  This is useful, because it gives you a meta-language for saying in all
  these places, do this, rather than having to go to all those places,
  and insert code to do "this". It is also, potentially, more robust
  with change, because it could catch all cases of some pattern, even as
  new ones are added. Of course, it may be that the pattern catches
  cases it should not, as new code is added, leading to some serious
  head scratching.

The funny thing is, AOP refactoring looks a little bit like the infamous
"comefrom" statement, and comefrom isn't widely thought to make code
easier to understand and maintain, but thats the claim for AOP.

What's even funnier to me, is I just looked up comefrom with google,
found:

  http://c2.com/cgi/wiki?ComeFrom

and apparently I'm not the only one who thinks AOP looks a bit like
comefrom!

Anyhow, thanks again for the links, they were very useful.

Cheers,
Sam

Quoteing david.naseby / eonesolutions.com.au, on Fri, Feb 06, 2004 at 07:14:27AM +0900:
> >-----Original Message-----
> >From: shasckaw [mailto:shasckaw / skynet.be]
> >Then I suppose it is possible to do that in ruby either. If some fair 
> >people could give some simple examples of practical AOP in ruby, it 
> >would probably help everybody to grasp the concepts.
> >
> The classic examples of AOP are logging and profiling. For more general
> business cases, a Java example is at 
> http://www.theserverside.com/articles/article.jsp?l=AspectOrientedRefactorin
> gPart1
> and my take on it in Ruby is at:
> http://homepages.ihug.com.au/~naseby/16.html
> 
> David
> http://homepages.ihug.com.au/~naseby/
>