HNHacker News
TopNewBestAskShowJobs

jasonhansel

9,140 karma · joined February 2, 2015

Website: https://jasonhansel.com
submissionscomments
jasonhansel··on Multiple assertions are fine in a unit test
I'd add one more: clearly document what determines the order in which tests are run.

On the one hand, running tests in any order should produce the same result, and would in any decent test suite.

On the other hand, if the order is random or nondeterministic, it's really annoying when 2% of PRs randomly fail CI, not because of any change in the code, but because CI happened to run unrelated tests in an unexpected order.

jasonhansel··on 3M Glass Cloth Tape 361
The best places for that are websites like Grainger and Fastenal. They sell all the things you see all the time in commercial businesses, but never realized you could actually buy. (Of course, they tend to be surprisingly expensive.)
jasonhansel··on 3M Glass Cloth Tape 361
IIRC it's surprisingly common to see bits of speed tape on commercial airliners, used to temporarily seal things off until they can be repaired more permanently.
jasonhansel··on Cloudflare Pages: Best server tech since CGI-bin?
Why not just make it CGI (or FastCGI) compatible so you can test it locally or run it in other environments? At least for things that are actually generating responses rather than acting as middleware.

Oh, right, vendor lock-in.

jasonhansel··on Kanye West is buying Parler
IIRC Trump wouldn't join Parler unless it agreed (among other things) to censor his critics. This seems to be a pattern with Trump: he demands that people be more loyal to him personally than to any abstract principle (including free speech absolutism).
jasonhansel··on How to build software like an SRE
That's why I said "except if your SLA requires it." If you've agreed--with other teams, with outside clients, or just as a project goal--that your service should work on 99.9% of calls, and you find in practice that you need to retry S3 calls to meet that target, then adding retries is reasonable.

If the problem is just that the 99 calls could overload downstream services on retries, the ideal solution is to add rate-limiting, though admittedly that is an imprecise science.

jasonhansel··on How to build software like an SRE
Yeah, I'm referring to the "log everything as JSON" format used by (say) MongoDB.
jasonhansel··on How to build software like an SRE
The answer is to "kick retries up the stack"; when you fail to reach a service, you return a 503 and have your clients retry, to avoid a case where every service in the stack starts retrying all at once and causes a massive increase in traffic.

IMHO you should only add retries if it proves necessary in practice to reach your SLA, if you're building something that isn't itself triggered by an RPC, or if you're performing an operation that can never be made idempotent.

jasonhansel··on How to build software like an SRE
> Structured logs are non-negotiable

I disagree with this. Logs should only be used by human operators; if you want something machine-readable, you should expose metrics via some other channel or record errors in a dedicated service.

Sure, some tools will let you read structured logs quite cleanly, but it will never be as nicely formatted as something designed, first and foremost, for humans. Of course, you may need to (say) tack on a request ID to avoid logs from different threads/goroutines/etc from getting interleaved, but that doesn't require everything to be in JSON.

jasonhansel··on How to build software like an SRE
No, "an SRE" is correct here; it's actually "a SRE" that would be bad grammar.

Whether you use "a" or "an" depends on whether the next word starts with a vowel sound, not with a vowel letter; since the letter "S" is pronounced "ess" in an acronym, you would write "an SRE," but "a Site Reliability Engineer."

jasonhansel··on How to build software like an SRE
Honestly, my answer is: don't use serverless, or at least have a non-serverless way of running your code locally, preferably outside of a container/VM. Otherwise you have no way of running or testing your code locally, much less attaching a debugger; IMHO this can slow down dev cycles so much that it cancels out the time saved by adopting a serverless architecture.
jasonhansel··on How to build software like an SRE
He's not discouraging automated testing; he's just saying that we should prefer integration tests (using services running locally) to unit tests of individual functions. Look up "testing trophy" for more about this philosophy.
jasonhansel··on How to build software like an SRE
> Never give up on local testing. It keeps dev cycle time much shorter than needing to rely on (and fiddle with) CI or remote workspaces.

Excellent advice for improving productivity and testability. I wish more teams would be sure to follow this by not adopting technologies that are impossible to test locally.

jasonhansel··on Why doesn't Bash’s ‘set -e’ do what I expected? (2021)
Annoyingly, when a process is terminated by an unhandled signal (say, SIGTERM), it is treated as if it exited with a nonzero exit code. This can make it tricky to use non-builtin commands as conditions in "if" statements, since there's always the potential edge case where the "if" block is skipped because of a signal that the condition received.
jasonhansel··on SQLite: QEMU All over Again?
SQLite and QEMU have been successful in large part because of their limited scope. Further expanding the scope of a project puts it at risk of becoming unfocused and unmaintainable. It makes a lot more sense to start a new project to support this use case than to try to reshape SQLite.
jasonhansel··on LSD-like molecules counter depession without the trip
Personally, I wouldn't want to take a medication that would permanently change my political views.

I seriously doubt there's a drug that reliably makes your political opinions more correct and truthful, but I'm sure that there are drugs that impair your judgment so much that you cannot tell you are impaired. So I would suspect that LSD falls into the latter category, not the former.

If the changes are irreversible, I certainly wouldn't want to take that risk.

jasonhansel··on LSD-like molecules counter depession without the trip
Not everybody wants to hallucinate.
jasonhansel··on LSD-like molecules counter depession without the trip
I can imagine someone saying the same thing about aspirin. "Pharma will do anything to sell you aspirin pills, when you can just get salicylates the natural way from willow bark."

No. Standardization, rigorous testing, and FDA approval are good things.

jasonhansel··on LSD-like molecules counter depession without the trip
You do know that these new psychedelic-like drugs are going to be patented and probably quite expensive, right?
jasonhansel··on Plant-based meat analogues weaken gastrointestinal digestive function in mice
I think that this really just shows that the digestive system changes and adapts to a plant-based diet. They haven't shown that there are any disadvantages to such changes; for all we know, this is actually beneficial.
jasonhansel··on Harrison Bergeron (1961)
I've always seen this story, less as a parable about our treatment of the disabled (or the gifted), and more as a lesson about envy. It shows what happens when you try to eliminate envy from society by bringing everyone to the same level, so that nobody has any "unfair" advantages.

edit: I think the telling line is:

> their faces were masked, so that no one, seeing a free and graceful gesture or a pretty face, would feel like something the cat drug in

The point isn't to make people equal for the sake of an abstract egalitarian principle, the point is to stop anyone from feeling envious.

edit 2: There is one obvious problem with this attempt to prevent envy. When you handicap someone, if the handicaps are visible, you can still tell by looking at the handicaps who has the greatest talent, as happens in the story. A more dystopian version would make the handicaps invisible.

jasonhansel··on Association between meatless diet and depressive episodes
There's actually some evidence that having left-wing political beliefs in general is associated with mental health consequences, because people with such beliefs are more aware of societal injustices, and because unhappy people are more likely to want change.

I suspect that this is a similar effect, probably enhanced by the fact that vegetarians are usually on the left. Did the study control for political views?

I'd be interested in seeing if this replicates in India, where many vegetarians are actually strong (religious) conservatives.

jasonhansel··on Association between meatless diet and depressive episodes
Some have argued that meat contains compounds that, while not strictly essential nutrients, are still beneficial, like creatine. But this is pretty controversial.
jasonhansel··on TikTok’s Ugly ‘NPC in Real Life’ Trend
Better yet, start playing copyrighted music so that YouTube will automatically remove the video. (Cops are known to do this to prevent videos of them from being spread online.)
jasonhansel··on “Titanic” Disaster: Report of the Committee on Commerce, US Senate (1918) [pdf]
Yeah, no redundancy could account for it, which is why confident predictions that the Titanic was uniquely unlikely to sink due to the presence of redundant systems were so ridiculous.

Keep that in mind next time you think your system is ultra-reliable because you have 50 instances of every service, but they're all running in us-east-1.

jasonhansel··on “Titanic” Disaster: Report of the Committee on Commerce, US Senate (1918) [pdf]
A classic case of correlated failures. If you have multiple redundant systems, but anything that damages one system is also likely going to damage others, then a failure is much more probable than you would expect based on the level of redundancy.

In this case the redundant systems were the watertight compartments. The engineers thought the ship wouldn't sink because it was unlikely for five of them to fail at the same time. But they forgot just how likely it was that any incident (e.g. an iceberg collision) that damaged one compartment would likely also damage many others.

jasonhansel··on Eventual Consistency in PBS (Probabilistically Bounded Staleness)
Something confusing about that chart: the range of the Y-axis doesn't start at zero, and it changes when you adjust the parameters, making it hard to see how changes to the parameters affect the probabilities in question.
jasonhansel··on Sudden disturbing moves for IT in large companies, mandated by CEOs
My suspicion: these CEOs are trying to scope out the cost of adopting OpenShift, so that, when they're negotiating prices with VMWare, they can show how much money they would save with OpenShift in the long term. This may be essentially just an attempt to gain some negotiating leverage in the face of potential VMWare price hikes.
jasonhansel··on “UBO Minus (MV3)” – An Experimental uBlock Origin Build for Manifest V3
100%. This is an a11y issue, not just about protecting privacy.
jasonhansel··on Python multi-level break and continue
Wouldn't you just write:

  found = next((
    (r, c)
    for r, row in enumerate(rows)
    for c, cell in enumerate(row)
    if search_query.matches(cell.value)
  ), None)
← PreviousPage 12 of 34Next →