3 ms·
Ask HN: How do you keep your technical docs in sync with code?
- jjgreen 3y agoDon't have technical documentation -- instead have - design documentation which has a date, and it is understood that it is correct at the time of writing but will age and become less accurate with time - clear code with comments on the sharp corners
- ardalanpouya 3y agoHow is design docs different from technical docs?
- jjgreen 3y agoThey are not updated, on purpose. This is the design now.
- ardalanpouya 3y agoIs that ideal for example for onboarding new developers? Our challenge is we are are starting to hire but we also move very fast and every time we refer people to our onboarding docs, they come back confused because some essential thing is now deprecated.
- jjgreen 3y agoHence clear code with comments on the sharp corners
- Double_a_92 3y agoDesign docs are for the developpers. Technical docs could also be for the users, by e.g. ending up in some manual or so.
- ardalanpouya 3y agoSorry. In that case I used a bad word. I probably should have said internal docs that explain some specific flow or behavior of the system. A good example is one that onboards new devs.
- Double_a_92 3y agoWe don't. Everything that is not part of the code will just get out of date. It's just best to reduce external documentation, or at least bundle all in one place. What works best is just creating a rough sketch of the idea, and store it somewhere next to the code with a datestamp. So it's clear that it's out of date, but if you really need some hint of how it was intended to work you can still look at it. (That is usually some class diagram, or a word document with explanations...) Or it's just kept up to date by being used. E.g. we have step-by-step instructions for certain tasks, that devs occasionally need to follow. So if things get annoyingly out of date we just fix the instruction that has become unclear with time.
- ardalanpouya 3y agoI like the idea of timestamping docs. How often do you run into something being "annoyingly out of date"? Asking because it happens alot for us with onboarding docs specially. I am trying to find out what we are doing wrong
- hitchstory 3y agoWith annotated, declarative step-based YAML integration tests. They autogenerate how-to markdown documents via a jinja2 template: https://github.com/hitchdev/hitchstory https://github.com/hitchdev/hitchstory (there are a few toy examples listed there) Depending on the app the docs might also embed artefacts generated under test - e.g. screenshots from playwright.
- ardalanpouya 3y agoThis is a very interesting idea. but I foresee two challenges here: (1) it sounds like alot of maitnance to keep a set of annotated tests that updates docs. (2) this does not sound like a solution for a company which produces handful of system behavior explaining docs on a daily basis. it looks like it is more so intended with low level documentation
- hitchstory 3y agoThe integration tests require maintenance like all tests do. The doc compilation step doesnt require much maintenance. There are examples there to demonstrate use on any level - e.g. to create unit-test level tests for a library or that generate code docs for programmers or playwright e2e tests that generate user-readable how to docs. The interaction code requires maintenance but a lot of it very boilerplate. E.g. you need a function to interpret the "click" step to do the proper playwright click or drag-drop but it should function more or less the same for everybody.
- ardalanpouya 3y agoGotcha! will take a deeper look. thanks :)