2 ms·
Tests express what we want the code to do, code expresses how we want to do it. It's the difference between giving someone directions to your house and checking
by philwelch 16y ago
Tests express what we want the code to do, code expresses how we want to do it. It's the difference between giving someone directions to your house and checking whether they made it.
- hxa7241 16y agoThere is not really a difference in software. The 'what' is defined by the 'how'. Imagine you had a very clear idea of the 'what', so complete that it could be used to test every possible output of the 'how' -- in which case, you already know all the answers and you don't need to have that 'how'. (The purpose of software is to produce stuff you don't already know.) You can compare the 'what's of two 'how's -- that is what testing is doing.
- philwelch 16y agoHm, I think of testing as more of knowing a couple of 'what's' and checking whether our 'how' correctly reaches them. There's an infinite number of 'what's' and we obviously can't test them all, but with testing we generally take a hopefully useful sample of 'what's' and make sure that our 'how' reaches them correctly. There is a style of testing where you devise two algorithms for the same thing and check whether they both reach the same result. I'm rather dubious of that style.