3 ms·
That's quite a nice idea! I certainly hadn't thought of that. I would upvote this several million times if I could. Another thing that sometimes makes sense i
by gdp 17y ago
That's quite a nice idea! I certainly hadn't thought of that. I would upvote this several million times if I could.
Another thing that sometimes makes sense is Model-Based Testing (I was involved in the ModelJUnit project - http://www.cs.waikato.ac.nz/~marku/mbt/modeljunit/ http://www.cs.waikato.ac.nz/~marku/mbt/modeljunit/ - for example). It can sometimes catch these kinds of subtle API misuse issues.
Finally, I did some work on a tool that will statically analyse a program and that will attempt to ensure that action a() never occurs before action b(), for example. I wrote a blog post about it a few days ago:
http://www.plsadventures.com/2009/08/prototype-static-analysis-tool-for.html http://www.plsadventures.com/2009/08/prototype-static-analys...
So it's not like it's an insurmountable problem (people manage to produce software!), but I definitely like your suggestion of using explicit state machines whenever you insist on using mutable state.