3 ms·
I find that unit testing can really corrupt a program's structure. Especially dependency injection which takes a normal top-to-bottom flow and flattens it out t
by tristian 18y ago
I find that unit testing can really corrupt a program's structure. Especially dependency injection which takes a normal top-to-bottom flow and flattens it out to a degree that makes it hard to decipher what is actually happening. So instead of A calling B calling C, C will be injected into B which will be injected into A and then the whole thing will be unwound. On a large scale it can start to look like interface soup. Perhaps interface-oriented programing would be a more fitting name than object-oriented. It certainly doesn't look like the classical OO style.
Having said all that, I would be loathe to give up all my regression tests. The freedom I have to change major parts of the program knowing I have all the tests watching my back is invaluable. As is the benefit of being able to codify my hard won knowledge about edge cases and the like which I'm bound to forget and lose track of.
I just wish I didn't have to give up a more natural coding style to get the benefits of unit testing. Perhaps a language designed from the ground up to support unit testing is the answer?
- StrawberryFrog 18y agoYou say "corrupt", others would say "decouple" or "improve"
- tristian 18y agoWell by "corrupt" I mean to alter it from its original form or intention. Probably not the best choice of words I must admit. "Decoupling" is a very useful tool. I think Joel's point of view was that unit testing often takes it to an extreme where the work to manage it outweighs the benefits. I personally don't agree with him. I think the benefits are too great to ignore. But I can certainly empathize with where he's coming from.