Code Documentation Debate

Discussions center on the necessity and best practices for code documentation, debating whether self-documenting code suffices or if separate docs are needed to explain 'why' rather than just 'how', and issues like doc rot and maintenance.

➡️ Stable 0.5x Other
3,818
Comments
20
Years Active
5
Top Authors
#927
Topic ID

Activity Over Time

2007
2
2008
21
2009
35
2010
68
2011
88
2012
136
2013
209
2014
148
2015
116
2016
161
2017
145
2018
215
2019
252
2020
252
2021
368
2022
400
2023
418
2024
358
2025
397
2026
29

Keywords

WHY e.g PHP AI IMHO HOW WHAT CI i.e BDD documentation code docs documented good code code ve examples comments written document

Sample Comments

jtdev Sep 10, 2020 View on HN

Code never lies, documentation/comments/etc. sometimes do.

danso Sep 17, 2018 View on HN

But documentation is often not code.

zestyping Sep 23, 2025 View on HN

Code can show you HOW something is done. Only documentation can explain WHY it is done that way.

sshine Oct 20, 2024 View on HN

The problem with "documentation" in commercial code is that nobody reads it.Any "documentation" that isn't embedded in code will never be opened again.Any "documentation" in the form of doc-strings and comments will, over time, lie.This is because competent programmers cannot agree on whether to even comment.When any large percentage of competent programmers do not comment, it is better to not rely on comments.Here's another pitch:<c

ianlevesque Sep 4, 2013 View on HN

Yes, with code documentation write "why" not "how."

seb1204 Jan 1, 2024 View on HN

Make it clear that documentation is part of the code. Missing or poor docu = code not acceptable.

BigJono Jun 25, 2023 View on HN

Documentation isn't a substitute for reading the code, and the best place for documentation is in the same file as the code.

jpalomaki Oct 7, 2018 View on HN

Self-documenting code typically can answer "How", but not always "Why"

mrguyorama Feb 8, 2018 View on HN

"Self documenting code" often isn't, in my experience

plaguepilled Jun 15, 2022 View on HN

Yes yes yes a million times yes.I need this engraved into the skull of every tech lead that claims the code is the documentation.The engraving will be appropriately referenced.It will also link to another engraving that documentation is good actually.