I started my talk with developing the motivation and the problem that drives us to have Aspect-Oriented Programming as a solution. After that I introduced AOP as the solution to this problem and talked about its position among programming paradigms.
In the next section of my session I went over some principles of AOP including the concept of cross-cutting concerns, aspect, join-point, point-cut, and advice. The session followed by a discussion on common misconceptions about AOP, potential issues with it, and a list of some big projects written in Java that use this approach.
One major section of the session was dedicated to the language support for Aspect-Oriented Programming and what we need to accomplish it in a language as well as the concept of weaving and how a weaver works by exemplifying that in the case of the .NET Framework, and introducing common techniques to implement AOP in .NET and a list of frameworks for AOP.
The next part of the talk was a brief introduction to PostSharp as one of the best AOP tools for the .NET Framework followed by two examples for logging and caching in a sample ASP.NET MVC application along with a discussion on the generated IL code by PostSharp.
I have to note that I had a mistake here that I had the impression that PostSharp relies on a Windows Service after installation but it doesn’t. Actually, it uses a post-build MSBuild task to detect the builds and integrate aspects into the code in order to generate a new IL code. Well, for unknown reasons I had the impression that it has a Windows Service!
The last part of the talk focused on AOP and Dependency Injection and how to achieve AOP via Dependency Injection with an example in Castle Windsor as well as a brief discussion about applying AOP to simplify Dependency Injection and inject the services in a join-point.
The closing remarks of my session were a look at the future of AOP in .NET, some resources for further reading, the availability of three free commercial licenses for PostSharp, and finally some acknowledgments for some people who helped me for this session (especially Dr. Shonle who has had advanced academic research and publication on AOP).
I think it’s worth mentioning here again that unfortunately Aspect-Oriented Programming is not well-promoted by the .NET community (unlike the Java community) and we need to do more work in this area. I hope I can have more specialized blog posts on AOP in .NET in the future.
I have to thank the organizers of Austin Code Camp 2010 for this great event and everyone for coming. I also would thank SharpCrafters for sharing free licenses with the attendees. I only could make it to Matt Hinze’s session on hard lessons learned from being stupid about Test-Driven Development and half a session by Rob Vettor on Visual Studio 2010 debugging. I had to head back to San Antonio earlier as I was so tired and couldn’t stay awake anymore!
I’ve published my slides here. It’s planned to publish the videos of sessions on Viddler. In that case I will update this post with the link to the video as well.