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.
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).