r/ProgrammerHumor • • 8d ago • Bravo 1

Meme commentsInJson

Post image
6.0k Upvotes

205 comments sorted by

View all comments

Show parent comment

80

u/herrkatze12 8d ago

Comments are specifically useful for config data, and should just be human readable descriptions of what the field does.

35

u/noaSakurajin 8d ago

Also they allow you to test changes to the config by simply commenting out that line. When editing Configs over ssh this is significantly faster that removing the line and is easier to revert.

7

u/Ixaire 8d ago

Yes but parsing comments to render them in documentation is definitely relevant.

That's why Knuth invented literate programming: https://en.wikipedia.org/wiki/Literate_programming

And that's also why XSD has specific documentation fields in addition to the standard XML comments.

1

u/herrkatze12 8d ago

That's actually one case where it might be useful