3 ms·
So where would you document the "why" then? This is often the question I find most difficult to answer when reviewing code (including my own) -- after all, I c
by quicklyfrozen 10y ago
So where would you document the "why" then? This is often the question I find most difficult to answer when reviewing code (including my own) -- after all, I can ferret out the what from the code.
- jstimpfle 10y agoThere's nothing wrong with what your parent said. If we are speaking of API documentation (i.e. function or module documentation): The "why" can't be explained here. It's at the caller side. There are more rare cases where it's reasonable to document the implementation of a function because there's a particularly tricky section of code -- and documenting the "why" makes more sense to me here.
- wellpast 10y agoIf you're able to ferret out the what from the code, then your code must be defect-free. Otherwise we need to know via the comment (contract) what is the what, so that we can fix the bug (or even know that there is a bug).