Why Would Anyone Hate TDD? | Prime Reacts

143,053
0
Published 2023-07-31

All Comments (21)
  • @limbo3545
    I do TDD when I know exactly what I need and how it has to work. That's not always the case. It's a tool like any other. No more, no less.
  • @EvilTribble1
    Far more common is technical debt driven development
  • @skleon
    For me the "problem" with TDD is that it amplifies the advantages and disadvantages of just testing. And there are MANY bad practices in tests. The most common one I see is testing implementation rather than behavior (that alone is the source of 90% of the pain of testing and refactoring). If you have bad testing practices, TDD will make everything worse, but if you have good testing practices, TDD will make things better.
  • @gavinh
    He said “…if you can love a tool.” Not “…if you can love at all.”
  • @k98killer
    I tend to write code twice: the first time, I just play around in a scratchpad repo with spaghetti; the second time, I structure the code more sanely and add tests. The second iteration can be TDD because by then I've figured out what I want the code to do.
  • @Jak132619
    I'm in the TDD camp, and I rarely write unit tests. I feel like unit tests are a bit of a straw man here, they are a terrible candidate for TDD for the exact reasons you gave: when tests are small they are difficult to refactor. You are coupling tests to functions/files/classes and if you ever need to move logic out of these places then you also have to change the test file which slows you down. TDD is better when you're writing integration tests: all your test should care about is the inputs and the outputs, so you're free to design and change the code however you want during refactoring as long as it gives the correct output from the same input.
  • @onecrazygenius
    The chatter who put "blue = rewrite everything (in rust)" is a based, high value programmer
  • @alfredomoreira6761
    Refactor part of TDD is also refactor of your design (not just implementation of your function). So yes, when doing TDD you throw away tests. Tests are a way for you to learn how to design, not just how to implement your function. This means, part of the work is throwing away all your code and your tests. Just like when you do it without TDD and you throwed your function away because you gained knowledge. Summary : Refactor = refactor implementation + refactor design Refactor X = create or update or delete
  • @LordOfElm
    When working on projects with other developers I'm significantly more concerned when JS/TS programmers import 600 moving target dependencies maintained by thousands of strangers than I am whether they wrote tests for their 20 line function.
  • @josda1000
    Prime... I think a unit is meant to be a public function, or similar. A private is an implementation detail. If you think this way, then you can refactor any way you want, including breaking up into private functions or even a class. Doing this means you won't necessarily have to specifically test the newly created class, but of course you can.
  • @chip243
    Thinking about comment at 5:50, if refactoring your code causes your black box tests to break, are you sure you are testing a black box?
  • @Kojikeneda
    It would be really cool to see you and Dave debate this on either of your channels.
  • @EyalShalev
    I think TDD forces you to write code that is easily testable. I've seen a lot of code written without testing in mind, which made it very hard to write good tests for it.
  • @vaisakhkm783
    0-test development is the best XD.... 1. i can ship project faster.. 2. I can get more money from client for fixing more bugs.... 3. but fixes create more bugs, means more money... and of course job security...
  • @fetherfulbiped
    I think Ian Cooper's talk about TDD addresses most of the problems with TDD better than Dave's video and most of the points that Prime raises as well https://www.youtube.com/watch?v=EZ05e7EMOLM&ab_channel=DevTernityConference. I personally do not like TDD that much, but I think it is extremely useful when you want to design an API/a tool that is supposed to provide some kind of a service to third parties/other services in-house because I find it easier to design the tool itself when I have to make black-box assertions about the tool's interface in a way that this tool's users would make, and it is really nice to have those assertions in the form of tests.
  • @cheaterman49
    Also, RE: skill issue and/or it takes time to "click" and/or "you can't get it if someone simply forces you", when I started introducing TDD to my non-backend-lovers juniors they absolutely loved it almost instantly (beyond admittedly a bit of initial "seems tedious") ; the boost in confidence they get from not only testing their code but being relatively certain (since the test failed initially) that their test actually exercises their implementation (... and that they didn't break anything else) is massive!
  • @markonovakovic3838
    I'm doing TDD for 4 years and I love it. I absolutely love it. In process of adopting TDD into my workflow I was so frustrated. I dropped it 3 or 4 times before finally adopting it. There are a lot of gotchas and you are better getting a mentor to resolve the confusion instead of stumbling onto those by yourself.
  • @bangonkali
    This is exactly why I always have 2 kinds of branches. 1 is for exploratory, experimental or prototypical stage (exp). Another for production code. These 2 are separate and have different goals but ultimately the end game is to deliver correct code. The exp branch is built in a fail fast manner to explore the problem space. It also includes exploration on how to implement potential solutions and how to test them. Sometimes we don't even know how to to build the test harness so this is the time to explore how one would go about it. The exp doesn't have to solve the problem to the end, it just has to establish the framework for means of solving the problem and the proof of concept on how tests might be written. Once a certain level of confidence has been established and presented to the group then we proceed to the next phase. The output of exp is then rewritten test first with tdd in mind in the production branches. The tests can be made in bulk at this time and one after another the implementation will follow. What's even funny is that sometimes QA team who works on test suites also have designed so many tests already that a separate team writes these tests in to code just to catch up with the amount of tests while implementation is ongoing. They are peer reviewed according to production quality standards. Sometimes the problem space is well known enough and the means to create test harness for them is well established don't need exp branches and can be worked on directly in tdd. So I would say we do xtdd approach. explore experiment or prototype when needed then do tdd for production code. One can then iterate features on production quality branches given the dev understands the problem space and the means to test well enough otherwise they need to explore first. For me I think it's about being practical and to actually give people the chance to understand before requiring rigid standards.
  • @anasouardini
    TDD is good, you just have to write your code first in a scratch pad so it doesn't count and then write your test and copy your code to it.