I have to comment my code because otherwise I have no idea wth I was writing 6mo ago.
Like, I recently had to update a script I wrote 2 years ago and had thought 'this is self explanatory, I don’t need to comment it’s only to have me come back and have to walk the code to figure out I forgot to include an edge case that hadn’t occurred yet …
Break it up into functions with names that describe what it does, then the script becomes basically a sequence of function calls and is easier to read and troubleshoot.
Yeah I dont know why people dont do this. Then an overall description of the script at the top is enough and anyone can just look at function names to see what is going on.
This is how I started writing my scripts and it is sublime. Even better is when your function can be a single return statement, makes writing tests easy.
I have to comment my code because otherwise I have no idea wth I was writing 6mo ago.
Like, I recently had to update a script I wrote 2 years ago and had thought 'this is self explanatory, I don’t need to comment it’s only to have me come back and have to walk the code to figure out I forgot to include an edge case that hadn’t occurred yet …
6 months - you’re good. 3 for me. 😄
Break it up into functions with names that describe what it does, then the script becomes basically a sequence of function calls and is easier to read and troubleshoot.
I’m on your side dude. Comments rot. Some are useless. Don’t even get me started on doxygen comments.
Yeah I dont know why people dont do this. Then an overall description of the script at the top is enough and anyone can just look at function names to see what is going on.
This is how I started writing my scripts and it is sublime. Even better is when your function can be a single return statement, makes writing tests easy.