3 ms·
I use comments to break up a large block of code into smaller chunks to explain what is happening / where we are in the process. I used to be a firm believer i
by chapliboy 5y ago
I use comments to break up a large block of code into smaller chunks to explain what is happening / where we are in the process.
I used to be a firm believer in self documenting code, but that approach often led to a large number of functions that only get called once. So lately, I have been just putting a comment line where I otherwise would have refactored the code into a function, and I feel that it has made my code a lot easier to read, and understand.
- spinny 5y agoSame here. The majority of my code is usually readable but still add comments on bigger chunks of code to split that code into logical sections, it's particularly useful when using a text editor with code highlight
- t-writescode 5y agoHow has your testing been impacted? I usually write several functions to isolate code for testing.