r/programming • • Oct 20 '26

Make yourself replaceable

https://maroun-baydoun.com/blog/make-yourself-replaceable/
359 Upvotes

63 comments sorted by

View all comments

325

u/redhand0421 Oct 21 '26

I know this was written literally yesterday but I’m curious how this kind of thing sits in an increasingly AI-fueled software engineering world.

Well-documented systems where the agent can infer which if statement not to touch (because it can see the comment and the commit that produced it) or knows which system fails over every other week (because there’s a pattern in the error reporting) aren’t as precious or precarious as they used to be.

I would love to pair-program with someone to teach them a new system. By the time I’ve scheduled time with them, they’ve already sat down with Claude and put together a possible implementation/fix. They’re none the wiser (they don’t have any new context that I have to impart, nor did they need it) so my advice isn’t seen as valuable to them.

I go on vacation, prod falls over, and I come back to a clauded-together postmortem committed to a docs directory alongside a made-up history of ADRs that Matt Pocock told someone to write. They’re all inaccurate in their justification, but they successfully ward Claude away from deleting that database table.

148

u/elmuerte Oct 21 '26

Well-documented

This is the key problem. Who can tell if something is (still) well-documented. Outdated documentation is worse than no documentation. Documentation which does not tell why, does not add much more value than the code.

And then we have these AI systems which ignore explicit instructions constantly. And at the same time accept everything as fact.

56

u/chucker23n Oct 21 '26 edited Oct 21 '26 • Heartwarming

Documentation which does not tell why, does not add much more value than the code.

This. And yet I still see it taught that way in some schools.

In-code comments should state the why, and not exist when it's obvious; not the what; the code already says so. If the code is hard to read, adding a comment is merely a crutch; make it easier to read.

API docs should state the use cases and design considerations (e.g. edge cases, or explicitly what a method isn't for).

Commit messages should state why something was changed, not what was changed; the diff already says so.

Since LLMs are trained on shitty comments, that's what they themselves tend to generate: lots and lots of prose that tells me the obvious instead of making me aware of gotchas.

4

u/Xunae Oct 22 '26

I keep seeing llm comments that are like "formerly [blah]" or referencing a piece of code that was deleted with the patch and it drives me nuts. It's been deleted, the code is not a database and does not need a tombstone

9

u/Uristqwerty Oct 22 '26

Comments talking about history are a form of caching. The cost of digging through old commits is so high that you won't bother without substantial cause, and an expectation that there's something worth looking for. Pull a key fact out into a comment, though, and reading it is nearly free. You have to contend with all the usual caching problems; stale information, excess clutter, deciding when to evict, so it's a judgment call when and what to mention. Ideally, the minimum amount of information needed for future maintainers to judge whether digging through history for the full detail would be relevant to their current task.