6
Hit 1000 lines of JavaScript with zero comments and it backfired hard
I thought comments were a waste of time for small projects, just cluttering up the screen. But after writing a 1000 line script for a client's checkout page last month, I came back a week later and had no clue what half of it did. Had to spend 4 hours tracing variables and if statements just to fix a simple button bug. Now I leave a comment every time I write a loop or a conditional that took me more than 2 minutes to figure out. Anyone else learned this lesson the hard way with a big old mess of code?
2 comments
Log in to join the discussion
Log In2 Comments
blair_allen1mo ago
Oh man, I feel your pain. That moment when you open your own code and it looks like a stranger wrote it is the worst. I've definitely been there, staring at a wall of logic wondering what past me was thinking.
4
the_joel1mo ago
Honestly though, I'm gonna push back on this a little. I kinda like opening up old code and seeing past me's weird choices. It's like a little time capsule of how I thought back then, you know? Sometimes past me was actually onto something clever, even if it looks messy now. Other times it's a hot mess but at least it's funny to see how wrong I was. Idk, maybe it's just me but I've grown to appreciate those moments as proof that I'm actually learning and improving. It beats the alternative of looking at old code and thinking "yep, I'd write it exactly the same way now.
6