Show notes
Code comments, they're important you need to have them but what you say in
the code comment is important so I worked at a place where we were startingto transition to ES6 and you know from using var to constant lead and youknow all the new cool features, you know, JavaScript and gotten a lot ofnew and interesting things in a long time and so we're all starting to usethese new things and I saw a lot of comments from some of my coworkersabout like basically describing what the syntax.Was doing because it was unfamiliar done oh so that was I was installing
with NPM and so in the in the code you would just find all sorts of placeswhere just described what the syntax was doing because we were we weren'tused to it. I never wrote those comments because those comments were notreally helpful and I would not recommend to anybody write those kinds ofcomments and like you could do the same thing for APIs to libraries thatthat you're using that you're not used to like or you know, you couldsay,Maybe you have a function component that returns null you could add acomment that says you when you return no it doesn't render anything, youknow, like you just go forever on code comments so it comes down to what isthe code comment actually telling and what's useful about it and yeah likethere there's a difference between a code comment that says what you andyou're doing and it could comment that says why you're doing it and that'swhat you really should be focusing on is what you're doing if it needs tobe explained then you should be doing what you're doing a littledifferently.Because code comment won't necessarily make it any easier to understand so
yeah, if if your code comment is just saying this assigns the variable rootto the string hello world like that is not gonna be at all useful but youcould explain why you're doing that now you say well our back end expectsus to send a hello world string because of this weird historical factsomething that somebody couldn't just Google and figure out you know, whatit's going on, you know, what with?With syntax that's something people can figure out but when it comes to
like business domain specific things that's the sort of thing that you wantto write a code comment about it's especially useful when you're defaultlike what you would expect somebody to do would be X but you can't do thatfor reason why and so then you explain why you're doing something that maynot be what people would expect you to be due doing that's what couldcomments are for it's to explain why you're doing something that may beunexpected.I hope that's useful have.A wonderful day.

