[LRUG] Writing specs for the time-complexity of a method

Tom Stuart tom at therye.org
Tue Oct 25 03:23:20 PDT 2011


On 25 Oct 2011, at 11:13, Tim Cowlishaw wrote:
> 
> Yep, that'd be my default position too - although then, if I was a
> die-hard BDD'er, I'd be able to implement the naive algorithm, then go
> home as all my specs passed. I guess I'm more curious about how you
> deal with time-complexity constraints under a mega-BDD regime.
> 
> Cheers!
> 
> Tim

As a BDD sympathizer, I'd humbly submit that your time-complexity requirement stems solely from your specific purpose of creating some code with explanatory value for a talk. This doesn't seem like the kind of requirement that arises in the 'real world'. I suspect what would happen in a 'hardcore BDD regime' is that you'd implement it naively to make the initial specs pass, then come across performance issues, profile, and put in a test that exercises the code in such a way that the naïve algorithm falls over, forcing you to rewrite the code with a more efficient algorithm.

Cheers,

Tom





More information about the Chat mailing list