T
25

Someone told me to stop writing comments before the code and it clicked

I was stuck on a Python project for my online class, so I asked a friend who codes for a living to look at my script. He told me I was writing comments explaining what I wanted each part to do before I even wrote the code, and that was slowing me down. He said to just write the code first, even if it's messy, then add comments after. I tried it on a calculator script and finished it in half the time. Has anyone else heard advice that seemed backwards but actually worked?
1 comments

Log in to join the discussion

Log In
1 Comment
the_sandra
the_sandra1mo ago
Actually, I've been on the other side of that where writing the comments first saved my bacon on a bigger project. I was working on a data processing script for a friend's small business, had to handle customer info across three different systems. I wrote out what I needed each step to do in plain English before touching a line of code. It helped me catch a logic gap where I would've messed up matching customer IDs. But for smaller stuff like your calculator script, yeah, jumping straight into the code makes total sense. Your mileage may vary depending on how complex the thing is.
4