Live data from Hacker News

Testing is better than data structures and algorithms

nedbatchelder.com

161–170 of 178 posts

Re: Testing is better than data structures and algorithms

#161
post #72

Earlier quoted context omitted.

No, it's called testing many concurrent operations. Implementing a complex concurrent algorithm based on your understanding of it, without proper testing is called luck, and often called delusion.

You can't easily, automatically test concurrent code for correctness without testing all possible interleavings of instructions, and that state space is usually galactically huge. It is very easy to write multithreaded code that is incorrect (buggy), but where the window of time for the incorrectness to manifest is only a few CPU instructions at a time, sprinkled occasionally throughout the flow of execution. Such a…

There's still value in eliminating ways your program can wrong even if you can't eliminate all of them.

Using your logic, why bother testing at all.

Re: Testing is better than data structures and algorithms

#162
post #88

Earlier quoted context omitted.

What algorithm ? The whole idea is that algorithms are useless, and you should just write a bunch of tests and go with it Yes, if I write stuff with locks, I shall ensure that my code acquires and releases locks correctly This is completely off-topic with the original post; 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 d…

It's not about making sure your system is 100% perfect. You cannot do that on any real sufficiently complex system. It's about testing the core functionality in a relatively straightforward and reliable way (including concurrency testing), to catch many common bugs.

My shit is the backbone of a multibillions compagny

Common bugs are not enough, uncommon bugs are just too expensive

Re: Testing is better than data structures and algorithms

#163
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;

https://antithesis.com/ was made to deal with this. You can think of its as a fuzzing but it has overall determinism for the whole system, so there is a time travel and interactive debugging.

Re: Testing is better than data structures and algorithms

#164

Earlier quoted context omitted.

Norvig mentions it in the article linked in the post to which you are replying. The game was Sudoku. The person was Ron Jeffries. https://ronjeffries.com/articles/-z022/01121/sudoku-again/

Thanks!

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.

Re: Testing is better than data structures and algorithms

#165
I find that test-driven advocates border on a religious way of thinking about software development, and I also find it sucks joy out of coding.

Does that mean I don't think tests are valuable – no, that's not what I'm saying. There are critical pieces of code where testing will bring you more joy because you'll catch very bad bugs that would have really ruined your day.

But as a way of constructing an application, it just has always felt really dull and uninspiring.

I know people will vehemently disagree with this. But, sometimes you gotta write the novel once to know what story you're telling. Then you can go back, edit, put tests in the critical places.

Re: Testing is better than data structures and algorithms

#166

Pure bullshit and incompetence. > esoteric things like Bloom filters, so you can find them later in the unlikely case you need them. They are not esoteric, they are trivial and extremely useful in many cases. > Less DSA, more testing. Testing can't cover all the cases by definition, why not property testing? Why not formal proofs? Plus, in our days, it's easy to delegate testcase writing to LLMs, while they literally…

> extremely useful in many cases. I've not ran into a case where I can apply a bloom filter. I keep looking because it always seems like it'd be useful. The problem I have is bloom filter has practically reverse characteristics from what I want. It gives false positives and true negatives. I most often want true positives and false negatives.

> true positives and false negatives

That would be a simple cache in most instances.

Re: Testing is better than data structures and algorithms

#167

Earlier quoted context omitted.

I'm replying to statements like this > "testing" is not fundamental. and > there is no real skill to be learned there one of the biggest problems that has plagued software is failed projects. There have been a lot of them, and its probably costs hundreds of billions of dollars. I can guarantee not one of those projects failed because somebody had to take the time to look up the best data structure. But I'll bet a lot…

Citation needed. I've seen projects fail for a multitude of reasons, by far the most common are boring political ones, like the leadership not understanding what it is that they want to build. 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. I assure you that if you have enough competence to actua…

> 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 can't fix the problems you don't even know you have due to lack of thorough understanding of the problem domain.

The problem domain is never the data structure or algorithm.

Re: Testing is better than data structures and algorithms

#168

It really depends. Working on genome analysis, I once encountered/interrupted (by rebooting after a software update) a student who had been running an analysis for more than a week, because they had not pre-sorted the data. With pre-sorted data, it took a few minutes. Not everyone works on web sites using well-optimized libraries; some people need to know about N and Nlog(N) vs N^2.

> some people need to know about N and Nlog(N) vs N^2. Every programmer should know enough to at least avoid accidentally making things quadratic. https://news.ycombinator.com/item?id=26296339

Or, to recognize when they or someone else has done so and recover.

It's often a case of "N won't be large here" and then later N does sometimes turn out to be large.

Re: Testing is better than data structures and algorithms

#169

Earlier quoted context omitted.

Citation needed. I've seen projects fail for a multitude of reasons, by far the most common are boring political ones, like the leadership not understanding what it is that they want to build. 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. I assure you that if you have enough competence to actua…

> 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 is "due to lack of testing". That's an unproductive line of reasoning because it is not possible or practical to test for every possible eventuality. This is why fields like formal verification exist.

>> 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.

ever tried to build a distributed cache??

> The problem domain is never the data structure or algorithm.

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.

Re: Testing is better than data structures and algorithms

#170

Earlier quoted context omitted.

Thanks!

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 bemusement.

Post reply on HN