• @willia4
    link
    191 year ago

    TDD is overrated. Code coverage is extremely overrated. Both of these tend to lead to a morass of tests that prove the compiler works at its most basic level while simultaneously generating a surplus of smugness about the whole situation.

    Tests have their place. Tests can be, and often are, valuable. But the easier the test is to write, the easier it would’ve been to just encode it into the type system to begin with.

    • @[email protected]
      link
      fedilink
      English
      61 year ago

      TDD as in religion is overrated. TDD done right is IMHO extremely effective.

      The problem is, writing good tests is really hard, and I have seen/committed/experienced a lot of bad tests… just the top of my mind problems with TDD done wrong:

      • testing the implementation instead the interface
      • creating a change detector
      • not writing / factoring the tests in a good way
      • writing tests / TDD w/o having an overall design for the software

      For every non trivial piece of software written w/o TDD, I always saw the same pattern: First few hours/days/weeks, rapid progress compared to TDD, afterwards: hours/days/weeks wasted in debugging, bug fixing etc… and the people can not even catch up with tests if they wanted.

      Is TDD always the answer? Of course not, it is a tradeoff like everything else in technology. OTOH I have yet to see a project which benefited from not using TDD by any metric after a few days in.

    • @[email protected]
      link
      fedilink
      41 year ago

      As someone who works on python code and kinda hates it, type annotations and a CI pass for mypy would catch the majority of our bugs. It’s painful

    • @[email protected]
      link
      fedilink
      31 year ago

      Yeah creating tests for every single method is insane. If a feature changes it’s more difficult you either have to figure out how to implement the change without changing the method, or you change the method and have update the unit test. But if you’re constantly updating the unit tests, how do you know if you might’ve broken something else that the test was intended for.

      It’s way better just to do integration tests that match the feature request. That way the feature that someone asked for will continue to work even if you decide to refactor the code.

      • @Alexstarfire
        link
        31 year ago

        Unit tests are only worthwhile if you refractor code or write the unit tests before writing the code. We started adding unit test for most everything where I work and I think it’s far more effort than it’s worth. It’s not that it catches nothing but it catches so little I don’t think it’s worth the time spent writing them.

        • @[email protected]
          link
          fedilink
          11 year ago

          Code changes that could affect tests happen all the time. It doesn’t need to be a specific refactoring of that unit.

          • @Alexstarfire
            link
            11 year ago

            I don’t think you understood my point. That’s exactly why I think unit tests aren’t all that useful. Most code changes require updating the unit tests so unless you change the unit tests first all that’s being done is saying, yep this works how I programmed it to work.

            • @[email protected]
              link
              fedilink
              1
              edit-2
              1 year ago

              But if unit tests that other people wrote unexpectedly break, you know that you changed things that you maybe didn’t mean to change.

              • @Alexstarfire
                link
                21 year ago

                Ideally. It’s just that more often than not it means you need to update the unit tests. I can still use my fingers to count how many times a unit test has caught a mistake I made, and I’ve been at my job for 10 years.

                I’m curious if others have a different experience.