Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Interview: Ramnivas Laddad on AOP Design, Modelling, and Policy Enforcement

Interview: Ramnivas Laddad on AOP Design, Modelling, and Policy Enforcement

Ramnivas Laddad talks about domain aspects, how aspects fit in the design phase, how to model aspects in UML, how to enforce policies with Aspects, how he used Aspects to diagnose production problems including touch threading problems, and using aspects to simplify design pattern implementation.

Watch Ramnivas Laddad on AOP Design, Modelling, and Policy Enforcement (21:16 min)

One particular interesting use of Aspects Ramnivas mentions involved enforcing single-threaded use: <blockquote>I will give you an example that was my first serious aspect that really helped me solve some problems. I was working on a Swing based project and used to get some intermittent problems, you suspected that it was some threading related issues. You might be aware that Swing is a single-threaded library, that means you are not supposed to call Swing components from any thread other than dispatcher thread. So we had this problem which showed up only once in a while, and for some reason whenever we gave it to customers that problem would show up for sure. We did a couple reviews, and spotted some points, but not really anything that helped us. So I wrote a small aspect that said: "Make sure that whenever a UI component is updated the caller thread is in the dispatch thread, if it is not then report it". So we compiled our code with this aspect, and just used that code in the jar file for a few days, just normal usage. And at the end of the day we got a lot of output that told us all the places the violation was happening (and the callstacks). So we knew exactly why it happened. And that time if I remember correctly it was AspectJ .8 version. So obviously I did not want to put that code in production, it was not the right thing to do. So I basically implemented the correct code manually so Aspects helped me to enforce the policy of single threaded rule.</blockquote>

See also the considerable amount of content on AOP at:

Rate this Article