Hacker News new | ask | show | jobs
by bruce511 1113 days ago
Comments and documentation.

I know it's not sexy, but adding lots of comments to the code will help to keep things organised, and will make your life next year sooo much better.

For higher-level concepts, usage examples, declarations of intent and expectation I cannot recommend "official" documentation more.

A lot of my career exists because I was forced by circumstance to write formal docs for my work. I refer to my own docs multiple times every day. Other people use my work because its documented.

And when I have to return to code, i find myself adding ever more comments to help me digest it. Personally I've never looked at code and thought "I can't use this, too many comments, too much documentation".

While I'm working I'm also writing (and rewriting) the docs.

For casual scribbles I use paper. I throw that away from time to time to reinforce how ethereal that is.

I have a motto now - if it's not documented, it doesn't exist. For me it matters 10x more than actual code, because it makes the code reusable, reliable and dependable.

1 comments

Thanks for the reply. What do you think turns people off documentation? I hear about doc rot etc. Sounds like you've really seen the light. One of the issues I've had with docs is that they are quite non-visual, I tend to diagram quite a lot to get a sense of how things hang together.
Docs can include pictures, even rudimentary ones made in the simplest drawing tools.

Programmers don't like writing docs because it's work, not fun like having code. In some companies that's "someone else's job" which is terrible.

When youre young you think you'll remember every line of code you ever wrote. (Spoiler alert, over a 40 year career you'll write a LOT of code).

Code is just code. Docs make the code usable. I get paid when the code is used (well, purchased) so my incentives were clear. Plus it makes customer support a Lot easier.