Live data from Hacker News

Testing is better than data structures and algorithms

nedbatchelder.com

171–178 of 178 posts

Re: Testing is better than data structures and algorithms

#171
post #99

Earlier quoted context omitted.

Did you Google “concurrency testing” and send me the top 5 results?

Maybe you should have googled 'concurrency testing' before telling me a story about how you worked at every tech company for 76000 years and never saw any concurrency testing lmao.

Obvious hyperbole aside, I never said "never saw any concurrency testing". I said I never saw a place that was generally and reliably testing for concurrency bugs.

That is to say that following the standard practices at that company, an average developer introducing a concurrency bug will only tend to find out about that bug in production. And even if the developer wants to implement concurrency testing they will probably find it difficult enough to do that they'll give up because it's not a normal part of the test suite.

This is less true for people working on infrastructure like operating systems, and databases than it is for web developers.

Re: Testing is better than data structures and algorithms

#172
post #98

Earlier quoted context omitted.

> Also, you cannot prove something by tests; Just because you found 100000 cases where your code works does not mean there is not a case where is does not (just as you cannot prove that unicorn does not exist) :) That’s exactly it. For any non trivial program, there exists an infinite number of ways your program can be wrong and still pass all your tests. Unless you can literally test every possible input and every b…

For any 'non trivial' program there exists an infinite number of ways your program can be wrong but you still believe it's right. Testing is not a perfect solution to catch all bugs. It's a relatively easy, efficient and reliable way to catch many common bugs though.

Sure but it's not a reliable replacement for understanding what the program you wrote is doing either.

Re: Testing is better than data structures and algorithms

#173

Earlier quoted context omitted.

> Also, you cannot prove something by tests; Just because you found 100000 cases where your code works does not mean there is not a case where is does not (just as you cannot prove that unicorn does not exist) :) That’s exactly it. For any non trivial program, there exists an infinite number of ways your program can be wrong and still pass all your tests. Unless you can literally test every possible input and every b…

And yet, (1) testing finds bugs in any nontrivial program that hasn't been tested, and (2) test long enough and with enough variety and you can make programs significantly more reliable. Perfect is the enemy of good, and absent academic fantasies of verified software testing is essential (even then, it's still essential, since you are unlikely to have verified every component of your system.)

Sure testing is useful. It's not so useful that you don't need to understand what you're doing though.

Re: Testing is better than data structures and algorithms

#174

Earlier quoted context omitted.

> Citation needed. [7 Software Failures Due To Lack Of Testing That Rocked The World]( https://www.appsierra.com/blog/software-failures-due-to-lack... ) > Hiring people who think bloom filters are "exotic" to work on a distributed system could certainly doom that project to failure regardless of how diligently tested it is. Citation needed. > Edit: to reframe it a bit differently: you can always add more tests. you c…

> [7 Software Failures Due To Lack Of Testing That Rocked The World]( https://www.appsierra.com/blog/software-failures-due-to-lack ...) Do you really think you can prove your point by showing me some sloplist of mildly high profile bugs? All these systems had extensive test suites and yet these problems happened anyway. Bugs happen in extensively tested systems literally all the time, but by your own logic, any bug i…

> Do you really think you can prove your point by showing me some sloplist of mildly high profile bugs?

Whatever I link to you are just going to say its AI, or inconclusive. There's a section on testing in the Mythical Man-month, but I can't link it here. But I don't see anything on getting the "fundamental theory" wrong.

> All these systems had extensive test suites and yet these problems happened anyway.

They were obviously missing some important tests.

> ever tried to build a distributed cache??

Why would I if I could avoid it? And building that, rather than finding it somewhere looks like nudge towards a project failure.

> The problem domain is literally always that. The way your data is organized and the way you work with it is directly affected by the exact problem you are solving.

That's just basic programming in the type system of your chosen language, not "fundamental theory" as you call it.

Re: Testing is better than data structures and algorithms

#175

Earlier quoted context omitted.

> [7 Software Failures Due To Lack Of Testing That Rocked The World]( https://www.appsierra.com/blog/software-failures-due-to-lack ...) Do you really think you can prove your point by showing me some sloplist of mildly high profile bugs? All these systems had extensive test suites and yet these problems happened anyway. Bugs happen in extensively tested systems literally all the time, but by your own logic, any bug i…

> Do you really think you can prove your point by showing me some sloplist of mildly high profile bugs? Whatever I link to you are just going to say its AI, or inconclusive. There's a section on testing in the Mythical Man-month, but I can't link it here. But I don't see anything on getting the "fundamental theory" wrong. > All these systems had extensive test suites and yet these problems happened anyway. They were…

> Whatever I link to you are just going to say its AI, or inconclusive.

There is no point in linking anything further because your line of reasoning is flawed to begin with, due to two reasons.

Reason one, your argument amounts to: software has bugs, and every bug is there because there was no test that would prevent that specific kind of bug (and it would if they were doing testing "correctly"). This is a completely vacuous argument because all software has bugs and therefore no one is doing testing "correctly" to your satisfaction anyway, which makes the whole discussion moot.

Reason two, you seem to be assuming that I am somehow advocating for not doing software quality assurance or not writing any tests. I am not. I am arguing that it is not worth investing extra time into learning that discipline, because a) not fundamental; b) you will be forced to learn it anyway. Therefore, spend your precious extra time on more interesting and useful things.

> But I don't see anything on getting the "fundamental theory" wrong.

Typically projects that get the basics wrong don't live long enough to find themselves in an AI training corpus used to generate listicles.

> Why would I if I could avoid it?

a simple "no" would have sufficed to establish that your opinion on usefulness of bloom filters in distributed systems probably shouldn't be weighed very high.

> That's just basic programming in the type system of your chosen language, not "fundamental theory" as you call it.

The fundamental theory bit helps to choose the appropriate data organization for your use case and either implement it yourself or modify a pre-existing implementation, or convince yourself that a pre-existing implementation is sufficient.

Re: Testing is better than data structures and algorithms

#176
post #57

Earlier quoted context omitted.

I mean, in your example you just have an incomplete test suite. (Though writing a complete one is often unrealistic) While understanding algorithms and data structures is important, the only way you really know how well it works, and how well it's implemented is by thoroughly testing it. There are an infinite amount of clever algorithms out there with terrible implementations. You need both.

Testing concurrency is extremely hard For instance, get sql queries; You ran them, and you have no issue; Is your code sane ? Or is it because one query ran 10ms earlier and, thus, you avoided the issue ? I truly wonder if there is real world tests around this; I bet there is only algorithm and fuzzing;

deterministic simulation testing[1] (DST)

[1] https://notes.eatonphil.com/2024-08-20-deterministic-simulat...

Re: Testing is better than data structures and algorithms

#177

Earlier quoted context omitted.

To be fair, I'd like to be forgiven for anything I did in 2006. It is a story that reads like a fairy tale, but it is time to give the guy a break.

That's why I linked to Jeffries' post where he gave more context. Though, in this particular case, he then went on to go back down the TDD Sudoku rabbit hole and, though he does seem to eventually write a program that works, the path to get there involved reading existing solutions and seems rather drain circly, which makes his post I linked seem a bit like making excuses. IDK. I don't really care beyond mild bemusem…

Haha, he really continued digging himself into the hole, i see it now.

"I’ve found some Python code for Sudoku techniques. I do not like it. But it’ll be useful, I reckon, even though we aren’t likely to copy it."

Re: Testing is better than data structures and algorithms

#178
This is a dangerous statement, although I don't think that was the author's intent:

> Before I get to other opinions, let me make clear that anything you can do to help you get a job is a good thing to do.

There are lots and lots of very evil things that will help you get a job, especially with companies that want to do evil things. Those are definitely not good things to do. I think the author intended a more restricted context like "any skill you can learn that will help you get a job is a good skill to learn from a technical perspective" (i.e., it might still be ethically wrong). This may seem pedantic but I've known some young graduates recently who went to work for very evil companies, and I think it's easy for impressionable minds to read statements like this and think "Yeah, see, everyone does it, who cares" without filling in the ethical background that the author assumes.

Post reply on HN