Hacker News new | ask | show | jobs
by nmfisher 1809 days ago
I think the point was more that many people can’t write unit tests because their code is so shoddy that it’s basically impossible to do so.

It sounds like you and I share a similar methodology. I don’t write unit tests for all my code. In fact if I had to guess, I’d say I generally test less than 25%.

But I do write all my code such that it’s capable of having unit tests written for it.

In many codebases that’s just not possible. The developers have spent all their time writing and none of their time thinking. It’s one big yarn ball that’s impossible to write unit tests for. For these people, forcing them to write tests up front would have resulted in a much cleaner code base.

2 comments

I do enjoy TDD, in that it makes it easier for me to ensure that I implement everything I need.

I completely agree that it's not always necessary, but I definitely find it a useful tool.

That being said, TDD with ML applications is a bunch trickier, as you'll normally have functions/classes which take an unfathomably looooooonnnnngggg time to run.

Well, I can agree with that!

Chances are that your code base will be untestable, at least for unit testing, if unit testing where not considered at all when writing it.