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?
3 comments

Log in to join the discussion

Log In
3 Comments
ivan462
ivan46218d ago
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
milalewis
milalewis18d 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