📢
12
c/coding-for-beginners•park.adampark.adam•1mo ago

I thought comments were a waste of time until my garden tracker app crashed

I used to skip adding comments to my code because I felt it messed up my flow. After building a small app to track my vegetable garden's water needs, I got stuck trying to change how it calculated sunlight hours. I spent a whole afternoon tracing through my own messy code just to fix one error. Now I see that writing a few lines of explanation makes the whole thing way less frustrating to work on later.
3 comments

Log in to join the discussion

Log In
3 Comments
mason_knight
Did you see that article on why commenting code is like leaving a trail of breadcrumbs? I read it last week and it totally changed my mind. The writer said how a few lines that say what you did can turn a headache into a quick fix. Like, instead of guessing why you used a certain formula, you just read your own note. Now I try to write comments even for small scripts, and it saves so much time. Your garden app story is a perfect example of that.
8
gibson.oliver
gibson.oliver25d agoMost Upvoted
Man, I was the same way. I used to think comments just cluttered up the code and slowed me down. Then I had to update a budget tool I made six months ago and couldn't remember how any of the formulas worked. Wasted half a day on it. Now I force myself to write a quick note on anything that isn't totally obvious right away.
7
jake322
jake3221mo ago
you don't say, who knew comments could actually help
1