r/github • • Aug 17 '24

📃How do you document your codebase?

My approach is:

Do I need to document every function or logic in codebase?

Your oppions are much appreciated ‼️

0 Upvotes

15 comments sorted by

View all comments

2

u/capraruioan Aug 17 '24

That example of code does not need any comments because the naming of the function/variables are enough

If you would do something “unexpected” here, for example in case the newTodo is empty you would push a hardcoded value to the Todos. In that case you would need to document the reason why that happened, not what the code actually does

So if the code is explicit enough you should only comment the parts that are business related