Why is a lot more important that what.
Here's an example I use (Verbatim from here[0]):
-
Why Vs. What
I’ve come to realize that the most important inline documentation concerns WHY we are doing something; not WHAT we are doing. For example, no one wants to read “// Set the value of b to 3,” for a line of code that looks like let b = 3. That’s just dumb.
let b = 3 // Set the value of b to 3
However, they may want to know “// Set the value of b to the number of iterations we'll be making.”
let b = 3 // Set the value of b to the number of iterations we'll be making
-
[0] https://medium.com/chrismarshallny/leaving-a-legacy-1c2ddb0c...