Finally got around to watching this presentation.
http://www.msteched.com/2010/NorthAmerica/DPR204
Thanks Shawn! it was good stuff.
Like Ben Day, i also program that way... it's very tough to try to program that way in a legacy program though. Which, i think every one of our programs is 'legacy' by the Michael Feathers definition. "code without tests"
I would add legacy code to me it is
"code without automated unit tests that give me rapid feedback."
I will further clarify:
"Legacy" is code that can not be tested and verified within 5minutes that all previous components still work in the same manner after my changes.
I say that because a unit test can be interpreted in many ways... but you cannot misinterpet the ability to fully regression test your code and detect breaking changes within 5 minutes.
and 5 minutes is a bit arbitrary... but the number is to mean "the maximum amount of time that the team will tolerate to run the test suite after every reasonable change"
and by reasonable i mean... if you write some new functionality that completes a goal then run the regression suite. If you're just writing a component class/method then just run the test harness for that functionality (runs very quickly).
So i feel like i'm rambling a bit but i've been really trying to stick to TDD in my code. I haven't really been able to achieve the structure that i would like... or the organization... i'm still struggling with finding the right folder locations and assembly organization.
That being said things are moving along nicely towards TDD bliss.
Next step is probably to figure out a IoC container... we already can use unity so i'll probably choose that out of laziness. I really love NInject the most though. Maybe once we're solidly on .net 3.5 i can use it.
One thing that i've also struggled with is dependencies... we have a 3 tiered application and each tier is impossible to contain in a unit test. So i generally have MVP with a service dependency, logging dependency(yea i know i should use AOP), configuration dependency, and view dependency injected into the presenter. It starts to get pretty hairy!!!
public class MyExamplePresenter
{
MyExamplePresenter(IExampleView view, IExampleConfigurationRepository config, IExampleBusinessLogicService service, IExampleBusinessLogicService2 service2)
{
Paraphrased of course... but sometimes the param list gets a bit long. maybe it's time to make a facade pattern interface for the BLL services? :)
TBD!