this post was submitted on 23 Sep 2024
67 points (100.0% liked)

Programming

17408 readers
74 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
 

Hey all, I'm still a junior dev with years of experience in IT. One of the things I've noticed since making the switch is that (at least where I work) documentation is inconsistent.

Things I encounter include incomplete documentation, outdated documentation and written process details that have assumed knowledge which makes it difficult for junior Devs to pick up.

I've had a search and a lot of what is out there talks more about product and how to document that SDLC rather than best practice in writing and organising documents against the actual software engineering and its processes.

Does anyone have any good sources or suggestions on how I could look to try and begin to improve documentation within my team?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 9 points 1 month ago (3 children)

The Code is my Bible.

Things I encounter include incomplete documentation, outdated documentation and written process details that have assumed knowledge which makes it difficult for junior Devs to pick up.

Yeah seems about right... off the top of my head:

  • self-host a wiki, use it to document stuff
  • write clean code that your future self will have an easy time reading
  • avoid automated documenting tools
[–] [email protected] 7 points 1 month ago
  • avoid automated documenting tools

the output of tools like sphinx, javadoc and so forth is a good starting point, especially if you feed them properly commented code.

the rule "garbage in, garbage out" definitely applirs here.

[–] [email protected] 7 points 1 month ago (1 children)

Writings self documenting code is so important.

Comments get stale and over time transition from: accurate to outdated, to eventually flat-out lies.

Go hard in the paint when choosing method or variable names. If it's hard to give them coherent names, that's a code smell.

[–] [email protected] 1 points 1 month ago* (last edited 1 month ago) (1 children)

Comments get stale and over time transition from: accurate to outdated, to eventually flat-out lies.

Sounds like some people aren’t doing their work enough then. Code comments are part of the work that a programmer should do, not an afterthought. Who else is gonna update that code if not the programmer? And if a programmer isn’t supposed to update their code and we can just all write clean code that would somehow make us all be better engineers (yeah, I use this title differently from programmers), then why are code comments even a thing?

Self-documenting code is good and all, but so should there be good comments.

[–] [email protected] 1 points 1 month ago (1 children)

I agree that would be ideal.

I flat out do not trust each of the 500 devs operating on our codebase to maintain comments.

Tests are documentation, code can be documentation. Those run through CI.

If you can keep comments updated at scale, do it. If you can't don't pray for a miracle and find something that you actually can enforce

[–] [email protected] 1 points 1 month ago

That’s why reviewers should also watch out for comments to ensure their quality. Hence why I said it’s part of a programmer’s job, not some afterthought.

[–] [email protected] 4 points 1 month ago (1 children)

If it's closed source then it's a losing battle to try and document code. I mean, do it when you feel it's 100% necessary (e.g. complex code that you really can't dumb down, "magic numbers" with a complicated backstory, test cases -- it feels like that's a different part of your brain so the transition is hard). Otherwise write code that almost reads like a sentence and don't add complexity until you need it.

[–] [email protected] 2 points 1 month ago (1 children)

write code that almost reads like a sentence

You mean COBOL?

[–] [email protected] 3 points 1 month ago

Hehe. COBOL doesn't look too bad. Reads a bit like a person that's never talked to another human being before.