Aspect oriented Everything?

Jason Williams jason at jasonandali.org.uk
Wed Aug 27 18:40:33 CEST 2003


In article <8ef9bea6.0308270810.7adfe408 at posting.google.com>, Hung Jung Lu wrote:
>>   def methodThatHasToListenForAnEvent
>>     listenForEvent(e) do
>>       # The method stuff goes here
>>     end
>>   end
 [snip]
> The question is: are there code spots that are not factored? If you
> have ONE single class that has to implement the before, around, or
> after methods, sure, nothing wrong with what you have said. But, if
> you have
> 
 [snip
> 
> You start to ask your self: how come the register() deregister() parts
> are not factor out? How can I factor out these parts of code?

Okay;

    module EventListenThing
     def listenForEvent(e)
      # ...
     end
    end
    
    class Thingy
     include EventListenThing
    
     def wotsit
      listen(e) do
       # ...
      end
     end
    end

What does AOP gain over mixins?




More information about the Python-list mailing list