Writing Decoupled, Testable Code With SubSonic

Thursday, June 19, 2008 8:00 AM by Michael Paladino

I've said it before, and I'll say it again. I love working with SubSonic! One of the only problems I've had with it is figuring out how to properly separate layers while using SubSonic. Rather than dealing with that problem, I have just avoided it and let all my data access and business rules all hang out together in my UI (specifically ASP.NET code-behind). And since I'm not writing tests for this project, testability hasn't been an issue. Wow. I feel dirty having just written those two sentences. Luckily, due to the relatively small scope of the project I'm on, those issues haven't burned me too bad yet.

Anyway, Rob Conery just posted a great entry on his blog dealing with this exact issue. He talks about using the Repository pattern and SubSonic 2.1 to properly separate your layers and allow for mapping between your DB and your application's model. Of course, separation leads to better testability as well.

It's too late in the game for me to change the architecture on my existing project, but I will definitely be looking at this approach very seriously on any new development. If you're actively using SubSonic and don't already have your layers adequately separated, I would highly recommend Rob's post. Thanks for the info, Rob!

Tags:   ,
Categories:   SubSonic
Actions:   Comments (0)

Template courtesy of Designs By Darren.
Modified by Michael Paladino

Sign in