News for hackers. Stuff that matters.
Re:Build a Database in 3000 Lines with 0 Dependencies by diggan on Monday January 20, 2025 @07:10AM (#42767870)
I think in general people tend to overdo TDD if they do TDD, aiming for a 100% test coverage which just ends up doing what you and parent mentions, solidifies a design and makes it harder to change.

If instead every test is well intentioned and focus on testing the public API of whatever you test, not making assumptions about the internal design, you can get well tested code that is also easy to change (assuming the public interface is still OK).

Re:Build a Database in 3000 Lines with 0 Dependencies by necovek on Monday January 20, 2025 @07:34AM (#42768039)
It's extremely hard to really do TDD and get code that's hard to change. If you persevere with a design that's hard to change, every single change in your failing-test-fix-implementation TDD cycle will make you refactor all your tests, and you'll realise why the design is bad and reduce coupling instead.

What really happens is that people write code, write non-unit "unit" tests for 100% coverage, and then suffer because those non-unit tests are now dependent on more than just what you are trying to test, all of them have some duplication because of it, and any tiny change is now blocked by tests.

Re:Build a Database in 3000 Lines with 0 Dependencies by hitchstory on Monday January 20, 2025 @09:24AM (#42769026)
You can get 100% coverage by focusing on testing the public API too. These two things are completely orthogonal.