When deploying this site for the first time and actually telling people to come here, I learned that I had made a pretty big mistake. Appropriately (or perhaps tragically), I made a mistake in one of the cross-cutting concerns of my own site.
I am using StructureMap to wire up all my dependencies, and 90% of these dependencies are just done WithDefaultConventions. But there is one dependency, IDbConnection which I wired up by hand, like so:
If you can spot the mistake here, then congratulations, you are officially a better developer than me (which is no high accolade). Here's what I should have done:
And then, in Application_EndRequest, I just call ReleaseAndDisposeAllHttpScopedObjects() on ObjectFactory. This means each of the SqlConnections will be bound to a request, and then disposed of when the request is complete. Because I wasn't doing that before, each of the connections would stay open. I didn't notice this when developing the site, because I was continually rebuilding and redeploying.
This may not be strictly speaking AOP, but it's certainly a cross-cutting concern, as almost every request makes use of the IDbConnection to use Dapper, and using StructureMap to manage that dependency saves me from writing a bunch of boilerplate "new SqlConnection" in all my repositories.
Lesson learned: if this site was actually mission critical to a business, I would've been in hot water. I should've been testing with a larger number of requests over a longer running application in an environment similar to production. Fortunately, since I didn't have a bunch of repetitive boilerplate, it was very easy for me to make the fix, once I figured out what the problem was.
Thank you for visiting, and welcome to Cross Cutting Concerns.
I've been evangelizing AOP (and PostSharp) for a while now, so I thought it would make sense to create a focused blog around this topic instead of using my much broader mgroves.com blog, as well as give me some additional motiviation to increase the frequency of my blogging this year.
So, what can you expect to see on this site? Well, a lot about AOP theory and tools, for sure. But ultimately, the goal of AOP is to improve your code, help you follow SOLID principles, save you time, make your app easier to maintain, and generally make life easier for object-oriented programmers; part of learning about AOP means learning when not to use AOP. While I mainly write C# and use PostSharp, this blog's charter is not limited to either of them. I may, from time to time, dive into AOP for Java, PHP, Ruby, etc, as well as look at other .NET AOP tools like DynamicProxy, LinFu, etc.
Also, I'm the sole author for now, but if you are interested in writing guest posts or becoming a regular author here, I will certainly be interested in talking to you about that.
One more minor note about this site: this site is not running on a blog engine like Orchard or BlogEngine.net. I tried a couple and ultimately found that I've been pretty spoiled on Wordpress and its impressive extensibility and customization options. However, I've never written a blog site on .NET, so I made that one of my requirements. So I ended up writing my own blog engine. Yes, I can hear you groaning and rolling your eyes. If you see bugs or weirdness, this is probably why, so please feel free to call me out on it so I can fix it. I also plan to open source it eventually (as if the world needs another blog engine).