18
Appreciation post: I started writing my code comments before the actual code
I was stuck on a function for two days, so I wrote out what it should do in plain English as a comment first. Has anyone else found this helps them think through the logic better?
3 comments
Log in to join the discussion
Log In3 Comments
miles9461mo ago
Seems like a lot of fuss for something that's just basic planning.
6
riverreed1mo ago
My team at the last startup called them ghost comments. I'd write the whole function in plain English first, then just fill in the code under each line. Saved me hours.
4
the_john1mo ago
Oh man, my buddy Dave did this for a whole payment system. He wrote a comment like "check if the user's card is expired, then charge it, then log the result" before any real code. He said turning the scary task into a simple to-do list made it feel like he already solved it. He just had to translate each line.
3