Poll Results : Does TDD improve code quality over writing tests after code?

It’s always a divisive topic but in your experience, does Test-Driven Development (TDD) improve code quality more than writing tests after the code is written?

I asked this question in a LinkedIn poll 📊 I took recently and the results were extremely close. There was only 17 votes extra in favour of Yes after a total of 803 votes.

How would you vote?
Does TDD improve code quality?

Remember, there’s NO RIGHT OR WRONG ANSWER!
Every developer’s journey is unique.

How would I vote?

I couldn’t vote in my own poll, but if I could (and based on my experience alone) I would vote No.

Mainly because I don’t think there’s anything inherently in TDD that will universally make code of a higher quality compared to writing tests afterwards, it always depends who is doing it and the context.

With TDD for example its said that it kind of forces you to think about testing etc. so better design comes naturally but I don’t need that. I always have a ‘how can I test this?‘, ‘is this testable?‘ mindset while writing code anyhow.

I don’t have to literally write the tests ahead of time to confirm that my code is testable, I already know it is from experience. This aspect as TDD as a design aid may help some, but it’s not universally helpful to all developers.

Leave a Reply

Your email address will not be published. Required fields are marked *