I have a concern regarding TDD, so I would love to...
# random
m
I have a concern regarding TDD, so I would love to hear your approach with this quick poll (also please comment in a thread if you want to add something valuable): What's your approach to making test pass? 1️⃣ Write the simplest possible solution. When writing first test this usually means hardcoding values from test into production. 2️⃣ Write solution in the easiest possible way. Easiest != simplest, i.e. if you already have a function that does part of the functionality required by test, you will call this function after first test, even when you could hardcode the value with the same amount of effort. 3️⃣ Try not to be too clever and implement functionality in a way that is more or less what you expect in final version of production code, e.g. when writing second test for immutable list of your own and adding
newElement
to
emptyList
, you return wrapper for
this.elements + newElement
instead of
listOf(newElement)
, even tho you know
this.elements
is empty. 4️⃣ TDD is dead 5️⃣ I don't test 6️⃣ I don't care about this poll 7️⃣ other
1️⃣ 3
2️⃣ 2
5️⃣ 5
3️⃣ 11
4️⃣ 12
7️⃣ 2
thread
v
As any paradigm, TDD is not to be followed dogmatically, IMHO.
👍 1
I write a working prototype, then add tests (fixing tests and the prototype as I go along), then write some more tests, then extend the functionality (basically using classic TDD). So it is a pragmatic mixed approach
c
@mg6maciej You're forgetting an important option: "I write my tests last"
m
I guess it falls in "other" category.
d
As I understand it TDD is about getting faster feedback from code, so exact steps depend on codebase, your skills, the problem at hand, etc. So generally speaking all options you listed can be valid in certain circumstances.
👍 1
b
Does "I let my users do the testing in production" falls in other category as well?
😎 1
m
I'd put that in "I don't test" category.
c
or “I use a dynamically typed language"
m
I heard you need to test more in those.
So it appears TDD is really dead. How do you call TDD practitioners then? Test-Zombies?
d
Define "dead" please 😅 I doubt it has ever been dominating practice so it might be more popular today than ever before.
1
m
d
Yes, I've seen it 😀 IIRC "agile is dead" was first and was a bit more sensible. Here it's DHH design and guilt problems.