4

I'm a long-time Java developer who's trying to make up his own mind about TDD.

I've used JUnit since I first discovered it in 1998. I use it regularly, but I don't subscribe to "write the test first". My coverage will range from 60-90%; I'm not compulsive about driving it to 100% in every case.

I read Extreme Programming when it first came out. I liked the ideas, but I've always been troubled by the dogma that accompanied it. "If it doesn't work for you, you're doing it wrong" has never sat well with me.

I found Martin Fowler's Is TDD Dead? It's good to see people like that debating the question.

I went over to Linus Torvald's github repo for Linux. Browsing quickly through the source tree revealed no evidence of anything like TDD. I saw no test code of any kind.

Can I conclude that TDD is not as common for functional and procedural languages as it is for object-oriented code?

duffymo
  • 3,032

2 Answers2

3

Can I conclude that TDD is not as common for functional and procedural languages as it is for object-oriented code?

No, you cannot conclude that by looking at a select (very large and legacy) codebase.

Browsing quickly through the source tree revealed no evidence of anything like TDD. I saw no test code of any kind.

These look like test code to me:

https://github.com/torvalds/linux/tree/9256d5a308c95a50c6e85d682492ae1f86a70f9b/tools/testing/selftests

Den
  • 4,877
2

First of all, TDD was invented a decade after Linux. Even non-TDD unit testing was not common before that, except on safety-critical projects. Second, it's not so much the language that's problematic to unit test as the domain. You basically have to mock out the computer hardware. A lot of the units are at a higher level, so it is doable, it's just not as easy as testing most desktop applications.

Karl Bielefeldt
  • 148,830