S
8

My friend said my Python code looked like a toddler typed it

I was working on a simple number guesser game and showed it to my friend Sarah. She pointed out I had one giant block of code with no functions, and said it was really hard to read. I spent the next week learning about breaking code into smaller functions, and now my new project, a to-do list app, is way easier to follow. What's the first thing you look for when checking if code is beginner-friendly?
3 comments

Log in to join the discussion

Log In
3 Comments
charlie_ellis
Actually, giant blocks of code are FINE. Sometimes you just need to see the whole flow at once without jumping around to twenty different functions. All that breaking up can make it HARDER to follow the logic. For a simple guesser game, a straight line of code is perfectly clear. People get too hung up on rules before they even understand what the program is supposed to DO.
6
angela_grant
Yeah @charlie_ellis I saw a blog post that said the same thing lol.
2
avery_lopez
Sarah kind of has a point though, but I also get what @charlie_ellis is saying about not overcomplicating things. For a tiny guesser game I'd probably just leave it as one block too since it's not that deep. Is it really worth a whole week of refactoring for a code snippet your friend took one look at?
0