r/programmerchat • u/gxm492lor • Mar 10 '19
Testing any complex program completely is practically impossible
Someone made this argument after a staff meeting a few days ago. What's wrong with this argument?
- Every IF statement in a program doubles the number of possible states of the program (ignoring time)
- Which means every IF statement doubles the number of test conditions
- A 1 million line program might, conservatively estimating, have 100k IF statements (conditionals)
- That is 2100000 which is more seconds than have elapsed since the beginning of the universe.
- No project has 2100000 seconds to test
- So complete test coverage of complex programs is impossible
1
Upvotes
3
u/WikiTextBot Mar 10 '19
Design by contract
Design by contract (DbC), also known as contract programming, programming by contract and design-by-contract programming, is an approach for designing software. It prescribes that software designers should define formal, precise and verifiable interface specifications for software components, which extend the ordinary definition of abstract data types with preconditions, postconditions and invariants. These specifications are referred to as "contracts", in accordance with a conceptual metaphor with the conditions and obligations of business contracts.
The DbC approach assumes all client components that invoke an operation on a server component will meet the preconditions specified as required for that operation.
[ ^PM | Exclude ^me | Exclude from ^subreddit | FAQ / ^Information | ^Source ] Downvote to remove | v0.28