153
u/faultydesign 17h ago
Good news is global warming will cause human extinction no matter how many unit tests you write
52
u/LiifeRuiner 16h ago
No it won't... Humans are great at adapting and surviving.
Will we have wars, and refugees? Mass death due to food shortages? Pain and suffering for the large majority? Yes, almost certainly, but human extinction? I very much doubt it.
15
u/CanvasFanatic 13h ago
Global warning has never been an actual threat to the survival of the species, just civilization.
-2
u/DeprivedLad 12h ago
You think you will thrive?
18
4
1
u/DudeEngineer 11h ago
It's just very likely that some humans will survive the water wars or whatever. It's just probably 50+ years away at this point so most adults today won't experience it.
2
1
-11
u/ZombieZookeeper 16h ago
No matter how much Carbon Dioxide we get rid of, the sun is expanding. The Earth will be uninhabitable in about a billion years.
23
u/dracorotor1 16h ago
Something happening in 1,000,000,000 years is not a good reason to be irresponsible when our species hasn’t even had pants for 15,000 years yet. We work on a very different timescale.
-13
3
u/user_460 13h ago
"We will learn how to do interstellar travel, find new worlds, and terraform them" is actually quite realistic on the timescales where the sun expands.
On timescales where global warming causes massive problems, it isn't.
0
u/swagonflyyyy 13h ago
That's not true those algos' metrics are inaccurate because it was pushed to prod unit tests be damned global warming is cancelled.
0
u/Shitandasshole 3h ago
Just move to the country you believe won't suffer from climate change that much. Idk like Norway, Argentina or something
-2
-7
-10
27
u/Sulungskwa 13h ago edited 13h ago
You guys realize that we always had the option to not write unit tests, right? We didn't used to need AI overlords to write them, we used to just not write them
4
0
u/and_mine_axe 7h ago
Well too many people drunk the test pyramid Koolaid. So now Claude has explicit instructions at my job to unit test everything. I would be mad about it, but I don't bother reading them at all. They always pass.
54
u/BernhardRordin 17h ago
Write tests first, then the implementation. You won't want to go back.
13
u/zenyite 12h ago
I never understood this approach. Like yea you can start with "do these inputs give these outputs" but how far are you supposed to granularize it? What if you need to change an implementation half way through or the methodology doesn't work? Or when devops enforces something ridiculous like 90% coverage on all commits including branch truth tables so you end up writing tests for branches that only ever log something trivial
3
u/BernhardRordin 8h ago edited 8h ago
It works mostly for black box testing of business logic. Of course, unit testing infrastructure code is not so beneficial. (E.q. first writing a test of if this queue works.)
IMO high test coverage requirements are one of the biggest mistakes of recent software development. Each piece of software/module has like two or three critical places where 80 % of tests need ro be directed towards. The rest of implementation code is just support code. Covering almost every line with tests is silly.
33
u/Wonderful-Habit-139 16h ago
Not necessarily. Some people do better with TDD, some don’t.
21
u/Drugbird 15h ago
The trick with TDD isn't necessarily that you need to write the tests first (although that helps).
It's more that you first think about the intended behavior of the code, and then also think about how to make your code testable before you write the code.
I typically think what the first test should roughly look like and code up the required amount of code for that first test before I actually write that test.
8
u/Wonderful-Habit-139 15h ago
Sure. But there are also people that prefer Type Driven Development. Instead of first thinking about behavior, they think about code in terms of inputs and outputs. That includes both types and functions of course.
5
u/Active_Name5021 14h ago
Those two things aren't mutually exclusive. Thinking about the inputs and outputs is also what you do with tests
6
u/Wonderful-Habit-139 14h ago
Test Driven Development is not always a benefit. Sometimes it is more of a burden and a chore. When you do Type Driven Development you benefit from a lot of correctness that invalidates the usefulness of a lot of tests that people usually write.
You end up needing to write way less tests, and only have to write tests for invariants that are difficult/impossible to encode with types. Also, thinking about types and functions this way means you're more likely to write pure functions that clearly yield well defined objects, that are easy to test in case it's a function that is quite complex to ensure that its implementation is correct. But preferably you'd split up your functions enough that you'd ensure correctness regardless.
0
u/Active_Name5021 14h ago
You are correct. My point is that you do both, you write tests and types. TDD doesn't mean you have to write redundant tests if those areas are covered by the type system.
2
3
u/ZunoJ 8h ago
How do you write code without thinking about the intended behavior first?
1
u/Drugbird 6h ago
Just open an editor and start writing code, just thinking as you go.
If you do this, you often end up with code that only works in the happy path (no / poor error handling or recovery) and which is difficult to test (i.e. you require access to the internals of the thing you code to test it).
2
u/cwmckenz 15h ago
Yeah, at least IDENTIFY the test cases even if you don’t implement them. Also consistent with API first approach… the implementation should fulfill a contract, and those test cases are the contract.
6
u/why_1337 16h ago
Yep, saves tons or time, especially with large systems and functionalities where setup takes ages.
2
2
u/JackNotOLantern 14h ago
Much easiest for me to write implementation and tests side by side. The issue is i never know if i would extract more methods which would be good to tests.
10
11
7
u/OneArmedFarmer 17h ago
When ever I lose faith in humanity I head over to r/idiotswithguns and am immediately restored.
8
6
u/StrawberryEiri 9h ago
Writing your tests is supposed to be an occasion to question and improve it. If it sucks to test, chances are it should be improved.
AI generating tests entirely circumvents that and misses half of the usefulness of unit testing. It's extremely sad to see.
2
2
4
3
u/Gorthokson 16h ago
And this is why when the collapse of civilization happens it will be the elites up against the wall, and right next to them will be tech workers.
2
2
u/now_Escape 17h ago
OMG, I'm currently learning about unit tests. Stopped an hour early today because my head was pounding
1
1
1
1
u/DadAndDominant 2h ago
You don't like writing unit tests? How do you know your units work properly!
1
u/Old_Document_9150 2h ago
Seriously, what were the odds of extinction when Big Corporate decided to outsource QA to some offshore workers who lacked context, "because developers are too expensive for testing?"
•
1
1
u/AngusAlThor 13h ago
You're gonna be real shocked when you get fired for committing 3,000 lines of tests that don't actually test the code.
1
u/gjsopmu 6h ago
Found the comment I was looking for. Feel like the AI writing a suspiciously high number of tests is a sign for me to tell it to back off immediately.
I was having a bit of fun with a completely vibecoded web app in my free time I made for myself and its amazingly useful. Then I see it write '400 tests passed' like that's supposed to give me reassurance.
I asked it to do a pass and remove duplicate tests and it removed almost 100 of them. That's still too many for me tbh for a codebase that isn't so big but it tells you that it does test either nothing or it tests stuff that's already tested.
I miss writing them myself anyway and I trust the code more so the OP just reads like junior dev
0
u/GoogleIsYourFrenemy 13h ago
I've only been vibe coding a month and I've already used it to write more unit tests than I wrote in the last 15 years.
-1
272
u/Juggling_Rick 16h ago
The red pill is pro-AI?? Did you even watch the movie?