4 ms·
You have to make sure your test cases exercise every possible code path. German demogroup .theprodukkt made a demo one time, .kkreiger, a first-person shooter g
by sp332 7y ago
You have to make sure your test cases exercise every possible code path. German demogroup .theprodukkt made a demo one time, .kkreiger, a first-person shooter game in 96kb. They used a technique like this to strip every line of source code that was not hit during a playtest. But the playtester didn't press the up-arrow in the main menu, so that doesn't work. More importantly they didn't get hit by any bullets, so in the final release the player is invulnerable because the code that handles damage was never compiled.
Edit: more informative link https://fgiesen.wordpress.com/2012/04/08/metaprogramming-for-madmen/ https://fgiesen.wordpress.com/2012/04/08/metaprogramming-for...
- ggm 7y agoYes. And its almost impossible to do this without a huge investment in time and effort, except: If you use languages with FP, and are rigorous, then I believe (possibly wrongly) its actually somewhat simpler to understand because the style of coding in FP exposes much of this "better" than in classic imperative coding So yes, I think you're right: great dream, hugely hard to do, if not actually impossible in most cases near as damnit, but there are places where program proofs take you to this, Military/Space/Medical needs to know the code calls don't have unexpected outcomes. And language choices which express as "how" you express code, can also help. Probably not enough.
- oblio 7y agoI think it's impossible, or close to it. Isn't it just another form of the halting problem? https://en.wikipedia.org/wiki/Halting_problem https://en.wikipedia.org/wiki/Halting_problem
- sp332 7y agoI'm not sure it's relevant. All real machines have limitations that we accept when we write programs and feed them data. Anyway just because you can't prove that all possible programs will or won't run correctly doesn't mean you can't prove this for a useful subset of programs.
- striking 7y agoWell, the alternative is that you limit the set of things you can do, such that you no longer have a Turing machine. But that's certainly less fun, isn't it?
- AnimalMuppet 7y agoDepends on your definition of fun.
- robto 7y agoThe halting problem states that it's impossible to know if computation will terminate in the general case, but there are lots of specific cases where we can prove that it will terminate. The Idris language compiler (think haskell with dependent types) will actually warn/error if you've written a function that it can't prove will terminate. It's actually really cool! If you're interested in learning more, I'd check out any talks by Edwin Brady or pick up his book[0] [0]Type-Driven Development with Idris
- o-__-o 7y agoThis sounds a lot like an Ethereum dApp...