F
30

Showerthought: I used to write my code all in one big file

When I first started learning Python a year ago, I put everything for my small weather app into a single script. It got messy fast. After watching a video from a guy named Corey on YouTube, I split it into separate files for data, logic, and display. The change made fixing bugs way easier. How do you guys keep your beginner projects organized?
4 comments

Log in to join the discussion

Log In
4 Comments
ivan462
ivan4622mo agoTop Commenter
My first big project was a text adventure game. I had the monster stats, the room descriptions, and the main game loop all in one giant block. Trying to add a new weapon meant searching for the right spot in a sea of if-else statements. It was a nightmare to change anything without breaking three other parts of the story. Splitting it into modules for characters, items, and the world map saved my sanity.
7
wadejenkins
Saved my sanity" seems a bit much, milalewis just called it spaghetti.
6
the_elizabeth
Going to disagree a bit here. My first messy file taught me exactly why modules matter because every time I had to scroll through that 800 lines of junk I felt the pain firsthand. That single giant script forced me to understand the problems with bad structure, which made me actually care about organizing my code properly later.
7
milalewis
milalewis2mo ago
Remember that one file where you had your functions, your data, and like, the print statements all mixed together? I found a bug once and had to scroll through 800 lines of pure chaos, it was like trying to find a specific noodle in a pot of spaghetti lol. My early projects looked like a junk drawer exploded onto my screen.
4