Lmao me commenting my 14 line bash script, comments almost as long as the script itself.
I have a habit of forgetting "why'd I put this there" and at least with my scripts I can leave myself a note for future me.
The highest comment-to-code ratio I ever wrote was a CMD script that had to combine three different escaping conventions.
It was a good day when I got to throw that one away.
Adding the fourth, ultimate escape to it.
Sounds like a good use of comments. Explain why, not how. (that should be readable from the code for the most part. Unless you're having function calls like xmmmuldp (simd) )
Well, bash scripts are infamous for being arcane so commenting abundantly is better than nothing.
This actually makes a lot of sense. A computer executing the code and a human maintaining it need to know different things. A human needs to knon what the code does on a high level (what the programmer intended), how it handles (or does not handle) edge cases, etc. A computer only needs to know how to run the code at a super low level. Without comments, it is impossible to know if code is doing the right thing, or what is expected from the caller.
Lmao me commenting my 14 line bash script, comments almost as long as the script itself.
I have a habit of forgetting "why'd I put this there" and at least with my scripts I can leave myself a note for future me.
The highest comment-to-code ratio I ever wrote was a CMD script that had to combine three different escaping conventions.
It was a good day when I got to throw that one away.
Adding the fourth, ultimate escape to it.
Sounds like a good use of comments. Explain why, not how. (that should be readable from the code for the most part. Unless you're having function calls like xmmmuldp (simd) )
Well, bash scripts are infamous for being arcane so commenting abundantly is better than nothing.
This actually makes a lot of sense. A computer executing the code and a human maintaining it need to know different things. A human needs to knon what the code does on a high level (what the programmer intended), how it handles (or does not handle) edge cases, etc. A computer only needs to know how to run the code at a super low level. Without comments, it is impossible to know if code is doing the right thing, or what is expected from the caller.