The Myth of Advanced TDD
This is an excellent post around using tests to drive design decisions. TDD is a much touted, much hated and much loved paradigm in the software world. This post shows how using mock objects in a test case allows us to expose design flaws in our codebase.
- Listen to the test cases to refactor and improve your code design.
- Mock objects and test doubles expose design risks early. If the code seems very tightly coupled to the test case, then change the design.
- If the test has duplicate assertions for the same field, that points to a missing abstraction.
- In your code flow if a lot of code seems inter-connected, consider using event sourcing to reduce the coupling. It'll make the tests also easier to write.
- Advanced TDD is indifferentiable from diligent TDD.
I've been trying to incorporate more TDD in my professional projects. This post was the trigger to be more conscious and diligent about it. Do you practise TDD in your daily flow? Any other resources I should read on this topic to get better?
Full Post here, 13 mins read