5 ms·
Tests don't cost time. Not true 100% of the time, but it's the right "default" mindset, because it's true the majority of the time.
by latch 9y ago
Tests don't cost time.
Not true 100% of the time, but it's the right "default" mindset, because it's true the majority of the time.
- wolco 9y agoFrom a pure number of keystrokes tests can add time. If you know exactly what to write because you have done this 100s of times before tdd will slow you down. If you are unsure of what the outcome of what you write tdd will give you training wheels and help guide you. That may make some quicker for a little while.
- krmboya 9y agoI find that when working in a team, tests help save time by preventing people from stepping on each others' toes, breaking existing functionality
- hinkley 9y agoPay attention, because it’ll be a while before anyone tells you this again: You are the sort of person people in this thread are warning others about. Nobody who ‘needs training wheels’ is going to get them from/do TDD. I’m more concerned about people who think they can fly without learning to walk. Most of us can type 60-80 wpm. Have you ever gotten close to that while coding? Typing is incidental. The very easiest part of your day. You’re right, they type less, because they’re so into the smell of their own farts that they refuse to believe their bugs are bugs, and they make other people clean up after them. Humans are fallible. We all have bad days. We all get distracted. We all misunderstand. We all change our minds. Don’t be so sure you got it right the first time. Even if the evidence supports you. You’ll be looking at a broken piece of code soon enough that you can’t figure out how it ever worked. Sooner or later it’ll be yours.
- rowyourboat 9y ago> If you are unsure of what the outcome of what you write tdd will give you training wheels and help guide you. That may make some quicker for a little while. In my experience, if you are unsure of how you are going to solve a problem, writing test only makes you slower. When you are coding exploratively, you will likely have to delete and completely rework what you did several times before you find what works. If you write tests for all but the highest level, those will just be scrapped along with the rest of the code.
- tejasmanohar 9y ago>If you know exactly what to write because you have done this 100s of times before tdd will slow you down. I once had this attitude. Then, I worked with other people. It makes all the difference. My perspective shifted when I was bitten by something small when making a small patch to a foreign system because someone else didn't leave good test cases behind.
- dionian 9y agotests do cost time, but an investment in an automated test can save orders of magnitude greater time than it takes to write them... in the end, automated tests save a lot of time, as long as they (A) cost relatively little to maintain and (B) provide a reasonably useful guarantee of quality
- threeseed 9y agoOf course tests costs time. You are often writing twice the amount of code and there is the amount of time it takes for most CI systems to run all of the tests (often tens of minutes, but I've worked on hours). But the reason we do it is because it increases quality.
- snowwrestler 9y agoI think the theory is that increasing quality will save time in the long run via fewer regressions and bug reports. Making that math work, though, seems to depend on the idea of some sort of future crisis state, where normal development is slowed way down. (You'd need to avoid a big slow down in the future, in order to balance out the continuous extra time given to testing.) Does such a crisis lurk in the future of every development effort? Hard to know. It's certainly not the only way technology projects fail. Plenty of products have passing tests but fail to find customers.
- dangero 9y agoExactly. It’s likely for some projects every line of code you write will in the end be a complete waste. TDD is only worth the trouble assuming any of the project succeeds. If not it may just be more wasted effort. For this reason I think a case can be made to skip TDD on MVP traction tests in some cases. A friend of mine just had his startup acquired, so his startup was an above average success and he told me 80% of what they built ended up getting scrapped.
- virtualized 9y agoThe problem is you don't know which 80% will get scrapped.
- dangero 9y agoI don’t see this as a problem as long as you make time to add tests later once you are convinced the code will be kept active through user traction.
- bkeroack 9y agoTests absolutely cost time, inversely proportionate to the raw ability of the programmer. A 95th percentile engineer can write cowboy code with zero tests that largely works. Enforcing tests could cause up to a 50% slowdown. It’s probably worth it in the long run, but for a time and cash strapped startup its a legitimate cost/benefit analysis.
- pavel_lishin 9y agoGod save me from code that "largely works".