Hey there! I'm a Software Engineer with a passion for helping others, which I do via YouTube usually. Feel free to reach out with business inquiries or if you'd just like to talk shop. Happy coding!
Using clear, descriptive names for variables and functions can go a long way. That said, I'll still use comments if I feel it's necessary for readability or to understand the code with less mental effort. Most of the time I end up using comments to leave notes for myself or the team, or if something might not be immediately apparent in the code like so...
// TODO: Fix this function that is breaking item checkoutconstbreakingCodeFunction=()=>{randomFunction();};// Add function to generate moniesconstmonies=()=>{// money generating code will go here};
Inside functions I also tend to leave code for readability, hacks, todos and even something like moment(date, 'MM/DD/YYYY').format('YYYY-MM-DD') to explain "why" that was done. People argue that comments can hurt readability but I haven't found such case yet.
Hey there! I'm a Software Engineer with a passion for helping others, which I do via YouTube usually. Feel free to reach out with business inquiries or if you'd just like to talk shop. Happy coding!
Yeah I agree. If it makes it easier to understand the "why" behind the code at a quick glance- especially if it's an older project you're coming back to after some period of time, I don't see any issue with it. As some others have already said, just don't go crazy with the comments.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Using clear, descriptive names for variables and functions can go a long way. That said, I'll still use comments if I feel it's necessary for readability or to understand the code with less mental effort. Most of the time I end up using comments to leave notes for myself or the team, or if something might not be immediately apparent in the code like so...
Good stance Corley!
Inside functions I also tend to leave code for readability, hacks, todos and even something like
moment(date, 'MM/DD/YYYY').format('YYYY-MM-DD')
to explain "why" that was done. People argue that comments can hurt readability but I haven't found such case yet.Thanks!
Yeah I agree. If it makes it easier to understand the "why" behind the code at a quick glance- especially if it's an older project you're coming back to after some period of time, I don't see any issue with it. As some others have already said, just don't go crazy with the comments.