r/ProgrammerHumor • • Oct 20 '26 • Bravo 1

Meme claudeWasNotHere

Post image
18k Upvotes

230 comments sorted by

View all comments

Show parent comment

0

u/[deleted] Oct 20 '26

[deleted] — view deleted comment

159

u/developer_soup Oct 20 '26

Me: TDD is the smart way to do things.

Also me: ehh... I'm just prototyping, I'll get around to the tests...

36

u/DERPYBASTARD Oct 20 '26

Yes, but I'm not smart.

33

u/AdminsLoveGenocide Oct 20 '26

Me: TDD is the smart way to do things.

I think this is something developers have chosen to believe with close to zero evidence.

39

u/Dreadgoat Oct 20 '26 • Bravo

TDD is the best solution in the magical fairytale world where you have complete and correct requirements.

7

u/AdminsLoveGenocide Oct 20 '26

I think even thats generous.

In my experience its a lot of effort for not much return. On top of the tests themselves you have to often code things in an awkward way to avoid having to mock everything out, or worse you have to mock everything out, or worse avoid otherwise useful patterns.

And for that you get what? 95% of the time they only catch an issue with the unit test itself and not an actual bug impacting the actual system. And then faced with evidence that the whole endeavour is a giant waste of time someone will sigh and say, if only we were implementing TDD correctly and try to use this failure of TDD as a reason to further indoctrinate impressionable junior devs on the importance of wasting their days on shitty unit tests that dont actually test anything.

Automated functional testing and full end to end testing are useful. TDD is just something dumb that people got scammed by.

11

u/Mongolian_Hamster Oct 20 '26

The fuck you on about. It's been proven time and time again.

Is it applicable to every situation. No. It never was meant to be.

5

u/AdminsLoveGenocide Oct 20 '26

How was it proven?

-5

u/Mongolian_Hamster Oct 20 '26

The onus is on you to prove it isn't since you claimed. You just came across someone who caught you in your bs. Use Google.

6

u/Lonsdale1086 Oct 20 '26

You can't prove a negative mate.

You're making a claim it's been "proven time and time again" that Test Driven Development is "the smart way to do things".

Prove it.

→ More replies (5)

8

u/Mongolian_Hamster Oct 20 '26

TDD doesn't mean writing tests only. It's a process.

If you're not writing tests for your projects then Jesus Christ on a bike.

2

u/ICBanMI Oct 20 '26

TDD works if it's something that you're not adhering to a real deadline. Plus you-or at least one person on the project-already know how to build it completely and how it should work.

It can also show you real quick which of your co-workers is terrible at procedural programming despite the test being open book and take as long as they need.

33

u/Pezmotion Oct 20 '26

I find Test Driven Development to be great if you are addressing a real production issue and can reasonably recreate the failure scenario in your tests.

That also helps prevent this specific issue from cropping back up again, if you're able to write a test with a comment that says something like "Adding this test to verify we fixed the bug that caused Ticket # 1234."

16

u/Steppy20 Oct 20 '26

Admittedly I've only been in the industry about 5 years now, but I've only used TDD on 1 service out of the ~50 microservices I've worked on.

It was a data query and calculation engine so we knew exactly what number should come out based on its input. Anything behaviour driven is much hard to write a unit test beforehand.

Deterministic dev? TDD is generally superior.

10

u/4xe1 Oct 20 '26

I find Test Driven Development to be great if you are addressing a real production issue and can reasonably recreate the failure scenario in your tests.

Is that TDD? The TDD people have the AI doing is writing tests before the very first line of code, and to implement new features, not merely fixing bugs on an existing product with users.

They do share methods and some of the associated benefits obviously, but what you describe sounds like just writing non-regression tests to me, not Test Driven Development.

8

u/helicophell Oct 20 '26

TDD is writing tests you know will fail, then writing/refactoring code that will pass said tests, then going back to write more tests for more features

Compiler errors are a form of TDD, like TypeErrors and Syntax errors

Everyone uses TDD in some form... most are just using the IDE to do it for them

6

u/dyslexda Oct 20 '26

AI uses TDD because it's the only way for it to know if something works or not. One shotting isn't anywhere near as good as folks might claim without TDD. The agent will write a test, write code, then run the test, realize the test fails, and try to treat that as a new debugging session. End user only sees the final result with passing tests. In other words, AI's tests aren't there for future use, they're a mechanism to mock up what devs themselves do (create a small part of a project, run it a few times until they're happy, then move onto the next).

4

u/Wonderful-Habit-139 Oct 20 '26

It's the best application of TDD. To prevent regressions. Outside of that TDD is pretty lousy, especially when you have Type Driven Development and are trying to figure out an elegant way of solving a problem. You might not know how the final API and code is going to look like ahead of time. And the "makes your code easily testable" is still easy to do when you define types and think in terms of functions and inputs/outputs.

4

u/Eric_12345678 Oct 20 '26

I almost never wrote 100% TDD. But you can be sure I write at least one regression test for every bug I found.

3

u/Pezmotion Oct 20 '26

I should have clarified that I also don't use TDD for new features, just fixing regressions. And as long as you write the test before fixing the bug in code, that counts as TDD!

27

u/Weekly_Interview_936 Oct 20 '26

TDD only works if you get fully defined stories with complete AC. And such stories are considered mythological as there are no verified reports of one being seen.

2

u/Wonderful-Habit-139 Oct 20 '26

Even then, the fully defined stories are not going to tell you how to structure the API or the folder structure or what inputs and outputs are going to help you write the code internally.

1

u/zenyite Oct 22 '26

What even IS test driven development, I literally don't understand it. Do you simply write all the tests first and write the code around it? How do you know what functions you are gonna test if you didn't write them yet? What if during coding you figure out a better way to write a bit of code that involves using 3 subroutines? You didn't write the tests for those so are they invalid? Do you go back to the tests and change them? Is that still test driven development? Do you have know in advanced that you are going making a discrete function that extracts some json data?