On Tim’s Treatise On Sloths
[...] they are SLOW.
I couldn’t agree more.
In all seriousness, however, I should point out that from my limited experience, Wordpress just deleted my post, that there are differences between a bespoke development project and a generalised solution/product development.
For a bespoke development, I couldn’t agree more that we simply don’t write that much difficult code that is worth testing.
In a generalised product that is supposed to work out of the box, configure itself in a foreign and what must be considered harmful environment, facing endless molestation and little games of feeding ‘funny’ shaped input, unit tests are extremely valuable.
I must add, though, that even in this case I believe that ‘a Java class as a unit’ is a ludicrous notion. I’m talking about at least a package/assembly, or a whole component that could be made up of several of those. I know by now I’m no longer talking about unit tests, but hear me out:
I once wrote a system that takes XML and generates Java code, that compiles against a Java library (also written by me) and supposed to do something. There were tests written about really really anal behaviours, such as ‘what if the user adds 59 minutes to 2AM just before daylight saving’ and so on.
Some time later, we had to port our system across to C++, and of course we didn’t have a requirement specification. The C++ guru we specially brought on board went “what the f?”
But when I explained that we had test cases and all he had to do was to write the program so it passes the tests, he went “ok”. And lo and behold, it was so.
I guess in the end, this anecdote really had nothing to do with unit testing.
Treatise.
ps. I am a sh**head.