this post was submitted on 06 Nov 2023
113 points (98.3% liked)

Programming

17408 readers
212 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
 

Curious to hear about the things that helped improve your programming ability.

you are viewing a single comment's thread
view the rest of the comments
[–] karlhungus@lemmy.ca 2 points 1 year ago (1 children)

I hear this quite a bit, and think there's actually a good deal of nuance to it. I've seen places that insisted on comments for everything, and it was silly, a significant number of comments had no value. This made people not read comments, as opposed to other places I've worked with very few comments - when you ran across a comment you gave it more weight (something here was complex, or not as simple as it seemed).

So imo, use comments which can communicate effectively, but use them sparingly for important parts that are complicated, for the rest attempt to communicate with the code itself.

[–] robinm@programming.dev 4 points 1 year ago* (last edited 1 year ago) (1 children)

step 1: learn to comment everything. This will helps code reviewer to catch errors because your code doesn’t match the comments

step 2: write your code in a way that makes comments useless and stop writting them

step 3: write your code just like you did in step 2, but documents all the things that you didn’t do, or why the code is more complicated than the naive approach. If your arguments are weak you are not in step 3, but in step 1.

[–] EatATaco@lemm.ee 3 points 1 year ago

I find that writing detailed comments about things that aren't clear in the code often lead me to a better, more clear solution. Same thing with writing detailed commit messages. So many times I realize something better during the message, I'll finish the commit and then almost immediately amend that commit with the better way.