B
15

My sister said she 'couldn't see the code' when I showed her my project

I was showing my sister a simple Python script I wrote that prints a greeting. I had it all in one big block. She said, 'It just looks like a wall of text to me, I can't see where one part ends and another starts.' That hit different because I never thought about how code looks to someone brand new. I went back and added blank lines between the import, the function, and the main call. It took five minutes but made it way clearer. Has anyone else had a simple comment make you totally change how you format your beginner projects?
3 comments

Log in to join the discussion

Log In
3 Comments
hugo_robinson25
Man, I used to cram everything together too. My buddy looked at a script I made and asked why the print statements were glued to the if checks. I told him it saved space, but he just shrugged and said it looked messy. Now I always put a blank line before a new section, like before a loop or after defining a variable. It seems obvious after you hear it, but you just don't notice when you're the one writing it.
8
riley43
riley434h ago
Wow, I used to hate blank lines but now I can't read my old code either.
3
tylerj22
tylerj228h ago
My old CS partner in college, Mark, used to call my code a "word avalanche." I had this one Java file with like 200 lines and no spaces between methods. He said it gave him a headache trying to find the main logic. Now I break things up with comments and blank lines even for tiny scripts. It just makes everything scan so much easier for the next person, or even for me when I come back to it months later.
2