O
23

Showerthought: I used to write code like a wall of text until a friend said it looked like a ransom note

Back when I was learning Python, I'd cram everything onto one line and never use spaces. A buddy looked at my script and said, 'Dude, this looks like a ransom note, I can't read it.' I mean, he was right. I started using line breaks and adding comments after that, and it made fixing my own mistakes way easier. Has anyone else gotten a piece of feedback that totally changed how you structure your code?
3 comments

Log in to join the discussion

Log In
3 Comments
nancy820
nancy8203mo ago
My old boss actually preferred dense code, said it saved paper when printing. I still write pretty tight but add line breaks for my own sanity.
7
tarac16
tarac1622d ago
Is poor formatting really that serious though? I mean yeah, comments help, but if someone can't read a few lines of code grouped together maybe the problem is them being dramatic. @nancy820's old boss had a point about paper, but honestly I'd rather just scroll than deal with five miles of vertical whitespace everywhere.
6
brooke475
brooke4753mo ago
My first code review in college had the word "spaghetti" written in red pen three times. I started leaving a blank line between functions after that, it's like visual breathing room.
4