3 ms·
See "Ashby's Law of Requisite Variety" http://pespmc1.vub.ac.be/REQVAR.html http://pespmc1.vub.ac.be/REQVAR.html which, practically, means you need to bring d
by PaulHoule 4y ago
See "Ashby's Law of Requisite Variety"
http://pespmc1.vub.ac.be/REQVAR.html http://pespmc1.vub.ac.be/REQVAR.html
which, practically, means you need to bring different tools to bear for different problems depending on the nature of the problem.
At some phases of some projects almost all the uncertainty involved is around the behavior of the framework you're working inside and you can unit test until you are blue in the face and it won't do you any good.
Some code is straightforward and barely needs tests, other code (say string parsing) involves well defined functions with inputs and outputs that are tricky to implement and starting with test cases is really the way to go. (Get an IDE with a good visual debugger if you don't already have one, tests together with the developer are awesome.)
If an algorithm is tricky at all I will look it up in an algorithm book. I definitely have made formal proofs that an algorithm worked when I wasn't sure.
This book I think makes the best case for unit tests I've ever seen
https://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052 https://www.amazon.com/Working-Effectively-Legacy-Michael-Fe...
and particularly emphasizes that unit tests need to be really fast because you're going to run them hundreds or thousands of times.
However there are needs for testing that don't fit that model and you have to fit them in that process. I wrote a multithreaded "service" and also a "super hammer" test that spawned 1000 threads and tried to provoke a race condition for 40 seconds, which is way too long to be part of your ordinary build process. You can spend anywhere from 2 minutes to 2 months training a neural network and you never 100% sure that the model you built is good (able to be put in front of customers) unless you test it. The pros frequently build several models and pick the best. It's not something you can afford to do every time you "mvn install" however, so you have to develop a process that addresses the real problems in front of you and that does not get bogged down trying things inappropriate for your problem.