HNHacker News
TopNewBestAskShowJobs

jmillikin

11,783 karma · joined March 23, 2009

https://john-millikin.com/

john@john-millikin.com

Currently semi-retired; formerly at Google (2011-2017) and Stripe (2017-2022)

submissionscomments
jmillikin··on Multiple assertions are fine in a unit test
GoogleTest (C++) and Go's built-in testing framework both support non-fatal assertions.

They're used for code like this:

  assert_eq(list.len(), 1)
  expect_eq(list[0].username, "jdoe")
  expect_eq(list[0].uid, 1000)
The idea being that if multiple properties are incorrect, then all of them will be printed out to the test log.
jmillikin··on Multiple assertions are fine in a unit test
Ah, this might be a difference of idiom. I would expect that assertion to print output like this:

  FAILED: Expected RESPONSE_NO_DATA, got RESPONSE_INVALID_ARG
  In /src/foo/ApiTest.cpp:123
For non-enumerated integers, the output would be something like:

  FAILED: Expected ResponseCode(200), got ResponseCode(404)
  In /src/foo/ApiTest.cpp:123
If values are formatted with some amount of self-description, then printing the name of the variable being evaluated is not usually informative.
jmillikin··on Multiple assertions are fine in a unit test
Some languages allow a stack trace to be obtained in normal code, which enables position reporting without macros. Python and Go are good examples.

If you know the file and line of the assertion, plus the values that are being checked, there's not as much need for a stringified version of the expression.

jmillikin··on Multiple assertions are fine in a unit test
Heard of it, but never read it.

Looking at the Amazon listing and a third-party summary[0] it seems to be the sort of wool-brained code astrology that was popular twenty years ago when people were trying to push "extreme programming" and TDD.

[0] https://gist.github.com/wojteklu/73c6914cc446146b8b533c0988c...

jmillikin··on Multiple assertions are fine in a unit test
Is it weird that not only have I never heard of the "rule" this post argues against, but I can't even conceive of a code structure where it would make sense?

How would a test suite with one assertion per test work? Do you have all the test logic in a shared fixture and then dozens of single-assertion tests? And does that rule completely rule out the common testing pattern of a "golden checkpoint"?

I tried googling for that rule and just came up with page after page of people arguing against it. Who is for it?

jmillikin··on Comparing TCP and QUIC
HTTP over plaintext TCP is obsolete in a similar way to Telnet (vs SSH) or FTP (vs SFTP). It took something like 20 years for support for FTP to be dropped from major user agents[0].

By the time the major browsers drop support for plaintext HTTP, that protocol will be as quaint and archaic as Gopher is today.

(and we'll all be better off for it -- good riddance to anything ASCII-based or unauthenticated)

[0] https://blog.mozilla.org/security/2021/07/20/stopping-ftp-su...

jmillikin··on Comparing TCP and QUIC
Operating a private CA is trivial, there are packages to automate it at every level from simple manual scripting to fully-automated ACME servers such as Boulder[0].

For proprietary software it's idiomatic to use a private CA for securing connections to a central server, to avoid the risk of DNS hijacking or a malicious third-party CA. For open-source software it will, definitionally, allow substituting different server key validation options for users who prefer to run their own servers.

The only real problem QUIC's mandatory TLS causes is that localhost development becomes marginally more difficult, but even as someone who loves running my in-development stuff on localhost it's clear that the security of the internet as a whole is of far greater value.

[0] https://github.com/letsencrypt/boulder

jmillikin··on Design and Evaluation of IPFS: A Storage Layer for the Decentralized Web
Because they're different files.

https://shattered.it/static/shattered-1.pdf

https://shattered.it/static/shattered-2.pdf

jmillikin··on Design and Evaluation of IPFS: A Storage Layer for the Decentralized Web
IMO the closest equivalent to an IPFS CID is a BitTorrent magnet URL. They both can be used to obtain an intermediate metadata value, which can in turn be used to fetch file content.

  > CIDs are still unique when referring to _metadata_, and can be used to
  > "unambiguously fetch content from its peers".
A CID, mathematically, cannot uniquely identify a single file. Consider the CID bafybcfbaqydfnrof5stdvkzhwx6kglb7p6owxja:

  [desktop]$ ipfs get bafybcfbaqydfnrof5stdvkzhwx6kglb7p6owxja -o temp.pdf
  [desktop]$ shasum -a 256 temp.pdf
  2bb787a73e37352f92383abe7e2902936d1059ad9f1ba6daaa9c1e58ee6970d0  temp.pdf

  [laptop]$ ipfs get bafybcfbaqydfnrof5stdvkzhwx6kglb7p6owxja -o temp.pdf
  [laptop]$ shasum -a 256 temp.pdf
  d4488775d29bdef7993367d541064dbdda50d383f89f0aa13a6ff2e0894ba5ff  temp.pdf
If you were to try fetching that CID from the peer network, which file you'd get would depend on which peer you're fetching it from.
jmillikin··on Design and Evaluation of IPFS: A Storage Layer for the Decentralized Web

  > Content addressing: IPFS uniquely identifies immutable content stored
  > on the network. This approach simplifies storage and reference to the
  > underlying data, as a node can use a unique key to unambiguously fetch
  > content from its peers.
This is unfortunately not true -- IPFS uses content addressing for metadata, but file content isn't content-addressed. The result is a network similar to BitTorrent's DHT, where if you know the hash of the torrent file you can download the content, but having a hash of the content doesn't get you anything.

An example I posted previously (https://news.ycombinator.com/item?id=32426051): debian-10.7.0-amd64-netinst.iso has SHA256 checksum b317d87b0a3d5b568f48a92dcabfc4bc51fe58d9f67ca13b013f1b8329d1306d, but a very large number of CIDs could be used to identify that file. The following two CIDs are both valid identifiers for it:

https://cid.ipfs.tech/#bafybeihjy54iyvheotna2aeqmzhqnro6yot4...

https://cid.ipfs.tech/#bafybeihfqpypuhmtyzazrj3g4b4f4nqk2ziy...

You'll only be able to download that file from IPFS if you know which CID to use, and if there are peers hosting it with the same CID.

jmillikin··on A step by step guide on how to become a DevOps engineer
SRE is a software engineering position -- someone needs to write the software (such as Kubernetes) that sysadmins use. It also requires a good understanding of lower-level languages, since someone who only knows Python will have a difficult time debugging a kernel panic or weird mutex issue in multi-threaded C++.
jmillikin··on Tesla engineers were on-site to evaluate the Twitter staff’s code, workers said
You're thinking of Twitter (TWTR). TSLA is Tesla, which is still publically traded.
jmillikin··on On Management and the Maginot Line
Your post says:

  > there are differences in productivity, as you'd expect, but even
  > the more-commonly-cited "10x" is bullshit.
and then you continue with the quoted statement that the comparison is between "normal, professional programmers" and someone 10x better than that.

However, that is not the standard meaning of "10x programmer". That term refers to someone 10x better than the worst programmer.

jmillikin··on On Management and the Maginot Line
The study that produced the "10x engineer" finding was not about an abstract sort of business value, it was about programming.

The claim that 10x engineers exist is: Given a group of programmers who are capable of planning and executing some project, the most effective member will be approximately 10x "better" (at speed / correctness) than the least effective member.

I've been on both ends of that 10x, but have never experienced a situation where all the programmers were approximately the same. There's always someone who is clearly more capable, and someone who is not.

jmillikin··on Hunting down the similar words between Japanese and Turkish
I've never seen 「同志」 used in real life. It seems to be a specialized term comparable to English's "comrade". Wikipedia thinks the Turkish equivalent is "yoldaş".

For the differences between two Japanese words with the same pronunciation and similar meaning, Yahoo Answers is a surprisingly good resource. You can also do web searches like [[ 「同志」と「同士」の違い ]] to find explanation pages. In general homophonic kanji is an area that even native speakers struggle with sometimes, so there's lots of non-English coverage available.

https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q10...

"「同志」と「同士」の意味の違いについて教えてください。"

jmillikin··on On Management and the Maginot Line

  > The comparison is always between normal, professional programmers
  > and those "10x" alpha-male
The commonly-cited 10x difference is between the best and worst engineers, not best and average.
jmillikin··on Hunting down the similar words between Japanese and Turkish

  > I think, for some of the words I will share with you at the end,
  > there is a high likelihood of those words having Chinese roots
  > rather than Japanese.
A rough (but not perfect) way to decide if a Japanese term is derived from Chinese is that it is composed of two or more kanji. Often you'll see a single-kanji word with Japanese pronunciation, and the same kanji in a compound use the Chinese pronunciation.

Examples from the article include 「感情」 (kan-jou), 「同士」 (dou-shi), 「反射」 (han-sha).

I'd also be careful about using jisho.org as a source without cross-checking to make sure you got the correct meaning. Some of the examples given in OP are wrong, for example 「同士」 is a suffix used to indicate a relationship is mutual -- 同僚 (coworker) + 同士 = 同僚同士 (coworkers) -- and 「大きい」 means "large", not "a lot" (which would be 「多い」 (oo-i).

jmillikin··on I can't find an original name

  > nonsense words "Nike"
https://en.wikipedia.org/wiki/Nike_(mythology)
jmillikin··on I can't find an original name
Why not name your project after what it does? Not everything needs to be a brand.
jmillikin··on Zelda Wiki Leaves Fandom
Several years ago the Touhou wiki left Fandom/Wikia for their own hosting. The Wikia admins responded by seizing control of the old wiki, removing any redirects or references to the new location, and banning the old admins.

The community largely followed to the new domain, leaving the Wikia version in a sort of dormant state filled with spam and weird "original fan-creation" pages.

https://www.reddit.com/r/touhou/comments/44prw7/what_went_wr...

https://en.touhouwiki.net/wiki/Talk:Touhou_Wiki/Archive_3#Wa...

jmillikin··on We're Drowning
In the "old" days ("old" being .. what, ten years ago?) packages were released as libraries, which bundled large amounts of functionality into a single atomic version. You could depend on OpenSSL for all your crypto code, GLib for argument parsing or atomics or UUIDs, libiconv for character encoding. There was some expectation (usually met) that the developers of these libraries would have some sort of basic testing strategy, and that they would try to maintain API compatibility over long periods of time.

A large program might have less than a dozen external dependencies, and they released every couples months at most, so keeping up to date was easy. And most of the time you didn't even need to update unless someone discovered a security vulnerability, which was not that common despite all the libraries being written in C or C++.

The approach of NPM (etc) is fundamentally different in that it's considered normal for a project to have hundreds or thousands of dependencies. To manage the update cadence, the users of these package repositories try to invent new schemes for version numbers -- or write quirky gif-laden blog posts about how they burn the monthly budget of a small country on testing in CI.

But the core problem is that they've locked themselves into a stupid and unsustainable paradigm. You can't do the sort of software development that involves writing code if you've decided that your job is to haphazardly glue together other people's code, especially when your're willing to depend on packages written by anything and anyone.

--

I honestly think a lot of the problem of over-dependency comes from the new package managers that make it too easy to depend on stuff recursively. If NPM required you to type out `npm add-project-dependency left-pad/1.0.0 --checksum sha256:a1b2c3...` then that would have been a strong forcing function against a huge number of tiny packages, because at some point your fingers get tired.

For example, in my personal projects I use Bazel as a build system, which makes me a bit more aware of dependency hell because each dependency needs to be registered.

There are projects like QEMU that are straightforward to build in Bazel because their dependency tree is bounded, but some of the stuff coming out of JavaScript land is just unavailable to me because I don't have the patience to chase down hundreds of packages to run a "hello world".

I've found I avoid certain parts of the Rust ecosystem because they're JS-ish, but there's other parts that have a more C/C++-ish style and those packages work fine for me. Similarly for Python. Go has largely avoided the issue, though I don't have an intuition as to why (different culture?).

jmillikin··on IDA cybersecurity software provider Hex-Rays acquired
The IDA decompiler is just generally more complete and more polished than Ghidra for the architectures it targets.

One issue with Ghidra's that I keep hitting is its poor support for amd64 SIMD. There's a good example at <https://github.com/NationalSecurityAgency/ghidra/issues/249>:

  0000000000000000 <intrinsics>:
     0: f3 0f 1e fa           endbr64 
     4: 0f c6 ca 1b           shufps $0x1b,%xmm2,%xmm1
     8: 0f 58 c1              addps  %xmm1,%xmm0
     b: c3                    retq   
IDA produces great decompilation:

  __m128 __fastcall intrinsics(__m128 a1, __m128 a2, __m128 a3) {
    return _mm_add_ps(a1, _mm_shuffle_ps(a2, a3, 27));
  }
The Ghidra output is a mishmash of CONCAT pseudo-macros.
jmillikin··on Just for Fun. No, really.

  > I made this for fun, I'm showing it to you so
  > you can laugh,
You can add +1 to your laugh counter, the "marketing" copy is what I wish every SaaS homepage looked like.

Out of curiosity, what does the user count look like? $4/month buys a lot of CloudFront.

jmillikin··on Don’t use Stripe. I am trying to save you from my mistake

  > I used Stripe for about a year to run a small cell phone store in Denver
  > [...] All of a sudden, we run a charge for $3300 because our primary
  > processor in my business was down,
This is the same story as https://news.ycombinator.com/item?id=32261868, even with identical wording. Interesting that it's posted by a different Reddit and HN account.

During the discussion it came out that this cell phone store used their Stripe account to sell a used vehicle[0], which is the sort of unusual activity that makes every regulated financial services company sit up and pay attention. A common risk mitigation is for the payment processor to hold the money in escrow until after the dispute period.

[0] https://news.ycombinator.com/item?id=32264886

jmillikin··on Ask HN: Recommended Rust Resources?
I'll add a (lone?) voice for diving in to the deep end straight away:

https://doc.rust-lang.org/reference/

https://doc.rust-lang.org/nomicon/

Documentation aimed at beginners often assumes a lack of prior programming experience, which is useful if you are (for example) a high-school student learning about pointers and abstraction but IMO not a good use of time for most people posting on Hacker News.

The Rust reference manual is well-written and comprehensive for basic Rust, and the Rustonomicon has often answered my questions about more advanced topics (FFI, concurrency).

jmillikin··on The US National Archives’ preservation plans for 600 file formats
Types of data are grouped by category, which have their own documents with recommended file encodings (including compression).

For example the document for digital audio[0] has FLAC as a "preferred" format and MP3 as "acceptable".

I didn't see any discussion of selecting formats based on recovery of original data from corrupted storage, and given the context I doubt that was given much consideration. When doing data archival it's better to have replication and checksums, then if any file is corrupt it's recovered from replica rather than trying to do a partial recovery.

[0] https://github.com/usnationalarchives/digital-preservation/b...

jmillikin··on Retrowin32, a Win32 emulator
Interesting! Is there a modern equivalent of kernel32, then?

I haven't done low-level Windows programming since before the 64-bit transition, but I thought they kept the model of a DLL wrapper with a stable ABI.

jmillikin··on Retrowin32, a Win32 emulator

  > Windows application don't need to bundle system libraries like the libc
That might be a bad example, because Windows applications are expected to bundle their own libc (MSVCRT). I'm not sure if modern Windows even ships with a copy -- it definitely doesn't ship with copies of all the versions that applications might depend on.

Linux follows the Windows model, where the stable interface is the kernel (Linux's syscalls, Windows's ntdll). This in turn implies that libc is a non-system runtime dependency, and a Linux application that wants to be portable across more than one release of Ubuntu (or whatever) should bundle its own copy.

Complaints of Linux ABI stability is mostly a story of old-timers trying to imitate how Unix worked in the '80s and '90s, with libc baked into the OS. Younger developers are more likely to use static linking or Docker/Flatpak/Snap.

jmillikin··on Russians hit the office and R&D center of Samsung in Kyiv
He moved from England: https://www.amazonredshiftresearchproject.org/slblog/2022-07...

  > I have relocated to Kyiv, mainly because with what’s going
  > on I feel on an emotional level compelled to be here, to
  > stand against the horrors.
  > [...]
  > The route was Cambridge -> London -> Bruxelles
  >   -> Köln -> Berlin -> Przemyśl (Polish border town)
  >   -> Kyiv.
jmillikin··on “Rust is safe” is not some kind of absolute guarantee of code safety
Analysis for memory safety is really hard. For >40 years there's been entire sub-industries focused just on analysis of C/C++ memory safety and it's nowhere near a solved problem. That's why Rust has `unsafe`, it's so the programmer has a way to encode logic that they believe is safe but aren't yet able to prove.

Analysis of panic-safety in Rust is comparatively easy. The set of standard library calls that can panic is finite, so if your tool just walks every call graph you can figure out whether panic is disproven or not.

← PreviousPage 8 of 34Next →