9
I finally understood why my code was so hard to read after a friend's blunt comment
Honestly, I was working on a simple Python script for about 2 hours, trying to get a list of numbers to sort. My friend Sam looked at it and just said, 'Dude, you have zero comments and your variable names are like 'x' and 'stuff1'. I can't tell what anything does.' I went back and renamed everything to things like 'user_scores' and 'sorted_list', and added a few quick notes. Ngl, it made fixing a bug later so much easier. Has anyone else gotten feedback that made you totally redo how you write your code?
3 comments
Log in to join the discussion
Log In3 Comments
the_robin24d ago
My old boss used to call that "writing code for your future self, who is tired and has no memory." Renaming variables from garbage like 'temp' to actual descriptive names saves so much time. It feels dumb until you have to debug it months later.
5
the_mia24d ago
Wait, you had a variable named 'stuff1'? That's honestly kind of impressive in a terrible way. My old code was a mess of single letters too, but I never sank to 'stuff1'. A professor once wrote 'WHAT IS THIS' in red on my printout and it changed my whole life.
-1
amyh1224d ago
That "WHAT IS THIS" comment from your professor is so real. I still find old notes where I wrote stuff like "fix later" and have zero clue what it meant.
7