by vinay_ys · 4y ago · 0 comments
Code can't lie (although it can be misleading with improper naming or bad abstractions).
Comments can be completely false (although they're easier to catch because the comments sit alongside the code)
Design docs almost always lies and it's hard to catch the lies because a design doc written 2 months ago is never going to match the resulting code perfectly. In my experience, people rarely update documentation unless there's a dedicated employee/developer advocate who is helping enforce and drive the culture.
But when you too lazy to update design docs, code and docs get out of sync. And it's always easier to just leave docs unchanged, because "hey, code works".
It's a bit similar to word processor compatibility issues on linux and windows. You can have perfect implementation of specification on linux, but Microsoft does some changes that are not specification compliant and now a doc created on windows does not open on linux. And from users perspective it's linux fault that file can't be opened, even though it's actually microsoft that is not following specs.
That depends how you're writing design docs. If a design doc contains arbitrary flowchars about what happens in the code, it will change.
But if you come up with designs similar to design patterns, you can document the pattern once, and use it in your code the way you use a design pattern.
Concepts that span a large codebase is also enormously paintful to figure out from reading the code. For instance object models / microservice architectures, complex state machines or security frameworks are hard to catch implicitly from reading the code.
I've worked on code older than I am and those little comments that probably should have been design docs were a godsend. Nothing else had survived.
I agree with you but in my experience unless you are writing this documentation in a regulated industry (with external incentives to keep the documentation up to date) the technical docs will eventually go stale or out-of-sync with the actual implementation.
We're talking about a line of code that has 2 words here. "A method to sort something" and "something to sort".