23
Old dev at a coffee shop taught me to write code for the next person reading it
I was at a Starbucks near my apartment last month, stuck on a Python script that worked but looked like a mess. A guy in his 50s saw me staring at my laptop and asked what I was building. He didn't offer to fix it, but he said something that stuck with me: 'Code is read way more than it's written, so write for the person who has to read it at 2am.' He showed me how he names his variables, like using 'customer_list' instead of 'x' and adding short comments before tricky loops. I went home and rewrote that whole script in an hour, and it made debugging so much easier. Has anyone else had a random stranger give them advice that totally shifted how you code?
2 comments
Log in to join the discussion
Log In2 Comments
nina14720d ago
Read somewhere that clarity in code is like a gift to your future self...
1
clairer7920d ago
Totally agree with you. I spent a week last month trying to untangle some old code I wrote for a side project, and it was pure misery. I didn't document anything or use clear variable names, and my future self paid for it big time. Now I always write comments and use names that actually make sense, even if it takes an extra five minutes.
8