Live data from Hacker News

Testing is better than data structures and algorithms

nedbatchelder.com

111–120 of 178 posts

Re: Testing is better than data structures and algorithms

#111
post #66

Always gonna have to side with Peter Norvig on this one: https://pindancing.blogspot.com/2009/09/sudoku-in-coders-at-... > They said, “Look at the contrast—here’s Norvig’s Sudoku thing and then there’s this other guy, whose name I’ve forgotten, one of these test-driven design gurus. He starts off and he says, “Well, I’m going to do Sudoku and I’m going to have this class and first thing I’m going to do is write a bun…

That story reads like what happens when the average senior engineer tries to do a hardish usaco problem; turns out algorithm engineering is different from your average enterprise engineering; turns out there are people in both camps

Re: Testing is better than data structures and algorithms

#112
post #2

Are there any resources out there that anyone can recommend for learning testing in the way the author describes? In-the-trenches experience (especially "good" or "doing it right" experience) can be hard to come by; and why not stand on the shoulders of giants when learning it the first time?

The Art of Software Testing. New York: Wiley, 1979 The Art of Software Testing, Second Edition. with Tom Badgett and Todd M. Thomas, New York: Wiley, 2004. It is by Glenford Myers (and others). https://en.m.wikipedia.org/wiki/Glenford_Myers From the top of that page: [ Glenford Myers (born December 12, 1946) is an American computer scientist, entrepreneur, and author. He founded two successful high-tech companies (Ra…

As I recall this was a book that included the orthodoxy at the time that random testing was the worst kind of testing, to be avoided if possible.

That turned out to be bullshit. Today, with computers many orders of magnitude faster, using randomly generated tests is a very cost effective away of testing, compared to carefully handcrafted tests. Use extremely cheap machine cycles to save increasingly expensive human time.

Re: Testing is better than data structures and algorithms

#113
post #54

Earlier quoted context omitted.

> "testing" is not fundamental. there is no real skill to be learned there, it's just one of those things that will find a way to steal your time anyway so there is no point in focusing actively on it. that's an edgy take and a red flag

it is not edgy whatsoever. it reflects the actual reality on the ground. nobody goes to school to learn how to use git or how to write unit tests. it's not something that needs to be actively "learned", you'll just absorb it eventually because you can't escape it. The more interesting and important things you will never "just absorb", you actually have to make a conscious effort to engage with them.

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 of them failed because they didn't follow smart testing practices and collapsed under their own weight of complexity, untestability and inflexibility.

Re: Testing is better than data structures and algorithms

#114
post #81

Earlier quoted context omitted.

The algorithm I'm talking about is at the very end of the book. If you start reading it from start to finish you might stop before you reach it. Certainly happened to me. Someone had to point it out for me to realize SICP had the answer all along. https://eng.libretexts.org/Bookshelves/Computer_Science/Prog... The explicit control evaluator. It's a register and stack machine which evaluates lisp expressions without t…

A common story with JIT languages is to go back and forth between having a bytecode interpreter and not. The paradox is that when the interpreter is fast enough then you delay JIT because it takes longer for the amortized cost to be justified. But that also means the reasons for that high amortization cost don’t get prioritized because they don’t really show up as a priority. Eventually the evidence piles so high nob…

I wanted to preserve the "code is just lists" property of lisps. Compiling the lists away means that property is lost: the code becomes bytecode or native code instead, sacrificing lisp's soul in exchange for performance.

I want to implement a partial evaluator one day. That should go a long way to improving performance by precomputing and inlining things as much as possible.

Re: Testing is better than data structures and algorithms

#115

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

Indeed. As an anecdote, I've come across a self professed frontend UI guru writing quadratic code that worked fine in testing because it only had to display a few tens of items there, but at a complete loss why it was unusable in production.

Re: Testing is better than data structures and algorithms

#116
post #97

Earlier quoted context omitted.

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

Kind of looks like it … the supporting evidence includes work from Microsoft: learning how to write concurrent programs. Surely not evidence that Microsoft is testing for concurrency bugs (of course they are).

> In Go 1.24, we are introducing a new, experimental testing/synctest package Clearly a mature mechanism we'd see in large companies...

Re: Testing is better than data structures and algorithms

#117
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://jepsen.io/

Re: Testing is better than data structures and algorithms

#118
As usual, the title doesn't reflect the message of the article. While critical against learning tons of algorithms and structures by heart, the author advocates understanding what they do and why you would want to use them. This is what it means to master TSA.

The last part denounces that testing is not tought enough, and learning it may be beneficial for your career. It's never said that testing is better than TSA, just that we would need more.

Re: Testing is better than data structures and algorithms

#119
post #102
post #99

Earlier quoted context omitted.

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.

They said twenty, not 76000. What a crock.

same thing

Re: Testing is better than data structures and algorithms

#120

> I see new learners asking about “DSA” a lot. I've noticed this "DSA" acronym appearing overnight. I can't recall people using it this much (at all actually) even six months ago. Where did it come from? Why do we suddenly need a term to talk about the concept?

That is the standard acronym for the course in American universities and has been for many decades.

Maybe so, but that doesn't explain why have people suddenly started using it more.
Post reply on HN