- aspect programming
I just watched the Aspect Oriented Programming presentation that Martin Seiler posted recently and I remembered how interested I was about this new paradigm a year ago. Then, I look at it again and wonder what its true value is. One of the major attacks against it is that it violates the locality of the code meaning that you can no longer (or, in fact, less than before) reason about a routine to convince yourself of (or prove) its validity: you also have to take the context into consideration (meaning the set of aspects in the system).
Furthermore, it seems that most of the experimentations has been conducted on languages like java which lack multiple inheritance. Would it only patch this lack of expressive power? For example, if we analyze the observer pattern presented in the video, we can see that an easy way to do it would be like this:
Of course, in the context of a MVC system, the granularity of this seems a little strong compared to event object but it think we can find an analogy with the advice and pointcut ideas: the redefinition of set_x and set_y define the pointcut and the notify_observers would be the advice. The main advantage here is that if we put contracts too strong to allow this redefinition, we can see that the error is in the redefinition: because the specification is too restrictive, it would not be too complicated to see that applying an advice is impossible.
One may object that we cannot specify a pattern to match the join points. This idea appears a little hazardous to me since there can remain errors that a simple symbol lookup would find but since it's only a textual pattern matching, no validity test can be performed.
I'd like to hear the opinion of other Eiffelists,
On aspects: Martin Seiler: No more boring TV