Earlier quoted context omitted.
> Some might claim unit tests will solve this Yes. Tests will solve this. Your point is perfect for tests. If another experienced coder cannot comprehend from the tests why something is wrong, then improve the tests. Use any mix of literate programming, semantic names, domain driven design, test doubles, custom matchers, dependency injections, and the like. If you can point to a specific example of your statement, i.…
> a complex method that you feel can be explained in documentation yet not in tests, I'm happy to take a crack at writing the tests. // This implementation is unnatural but it is needed in order to mitigate a hardware bug on TI Sitara AM437x, see http://some.url (that's an obvious one; but there are plenty of other cases where documentation is easier than a test)
One way to implement this is by using two methods: one normal and one with the hardware mitigation code, with a dispatch that chooses between them.
This separation of concerns ensures that your normal code runs normally on normal hardware, and your specialized code runs in a specialized way on the buggy hardware.
This separation also makes it much clearer/easier to end-of-life the mitigation code when it's time.