3 ms·
If your application is so large, it would be good to ask first if it really needs to be so. We favor small methods, which do only one thing. We favor two pizzas
by maurycy 18y ago
If your application is so large, it would be good to ask first if it really needs to be so. We favor small methods, which do only one thing. We favor two pizzas teams, which are small. Why large applications are not considered harmful? You might want to move some of your functionality into different modules, libraries or separate applications.
The false premise lying behind the 100% coverage philosophy is that instead of avoiding bad practices and being careful with your every step, trying to make things as obvious as possible, tests let you not to think about it. You can stop worrying. They work like a committee, freeing you from responsibility. Especially if you're a mediocre programmer looking for constant excuses.
Articles about tests are mostly abstract. Kool-Aid's hectoliters why tests are great, yet nearly zero discussion how to get them right. Tests are not created equal. I follow Rails blogosphere, which is a very test oriented community, and I don't remember too many, if any, writings about how to write good tests.
For instance, let's raise confirmation bias again. People usually write tests to make sure the things work as they think they should. I've not seen too many agressive tests that tried to check exteme cases, to, literally, falsify the method. If you deal with things more complicated than Rails controllers, it becomes the real issue.
I also try to perceive tests in terms of ROI. If you don't plan to make your application big, why bother? If you don't plan to do any non-standard things, why bother? If it took five minutes to come up with an immediate and obvious solution, why bother? If you change your frequently ("writing is rewriting"), why bother right now?
I'm not saying that tests are all bad. I just don't get the whole hype, saying "write tests, be happy" without raising all risks involved.
- nostrademons 18y ago"If you don't plan to make your application big, why bother? If you don't plan to do any non-standard things, why bother? If it took five minutes to come up with an immediate and obvious solution, why bother? If you change your frequently ("writing is rewriting"), why bother right now?" Don't bother. When one of my programming mentors was explaining unit tests to me, she said "They don't have to be a huge deal. Just enough to let you have confidence in your code." That's the real issue - having confidence that your code does what you think it does and will continue doing so. I have a pretty simple litmus test for when I need unit tests: if I ever have to say "Well, it should work..." then it's time to write a test and find out if it really does. But I don't unit test things like Django models or CSS positioning, unless I'm doing something funky or complicated. I do unit test a lot of my JavaScript, since doing anything non-trivial is complicated.