Mavnn's blog

Stuff from my brain

Anyone Using FsCheck for Business Code?

Libraries like FsCheck ( http://fscheck.codeplex.com/ ) and  Pex always capture my imagination as fantastically clever and potentially useful tools. Along with things like strong type systems and code contacts they especially appeal to my long buried mathematical background.

Unfortunately, and probably because of said mathematical background, I sometimes struggle to think of ways to use them outside of maths and science problems. If I'm working on a maths library or I decide I want to write a sorting algorithm, trivially easy sanity checks of things like whether a function is cummutative or associative are immediately useful.

If I'm writing a service that polls an email address for bounced emails and out of office replies… I don't know. It feels like there should be things they can help me with: after all, over the years I've decided the strong type system is helpful even for this side of things, so surely the QuickCheck/proof side of things should be to. But the amount of work it requires to set up the test generators for complex data types (and then trying to formalize the acceptance criteria without just writing the actual implementation!) feels so large compared to the size of the project that I can never justify the time to actually use the tools.

So I'm left wondering: am I missing something? Is there a whole new level of treating ease and vigour I'm missing out on just because I don't have the imagination and experience to make good use of the tools right there in front of me?

Or are these tools only really useful in their own narrow field?

I suspect the middle ground; for the moment ideas are avoiding me in droves. Any good open source examples out there of these tools in use for the kind of 'business' code that most of us spend most of our time writing?

Comments