Am I the only one who used to write everything in one giant file?
Honestly, when I first started learning Python about eight months ago, I wrote my entire first project, a simple text-based game, in a single script that was over 500 lines long. It was a mess of functions and variables all crammed together, and if I needed to change one thing, I'd break three others. I got so frustrated trying to find a bug that I almost quit. Then I watched a video from a guy named Corey Schafer where he talked about breaking code into modules. I tried it on my next project, making separate files for game logic, player data, and the main loop. Tbh, it was a bit confusing at first, but after a week it just clicked. Now I can't imagine going back to that old spaghetti code. Has anyone else made a switch like this and found a specific way to organize their files that really helped?
That "spaghetti code" line hits home. My first project was just a single file named "project_final_final_v2_real.py" that was basically a digital ransom note. I think the real turning point was when I tried to add a new feature and my own code stared back at me like a hostile stranger. Splitting things up felt like adult supervision finally showed up.
Oh man that naming convention is too real. I still find files like "test_new_idea_FINAL_revised.py" from six months ago that I'm scared to open. The worst is when you leave a comment for yourself that just says "what was I even trying to do here?" and future you has no clue either. Breaking it into modules is the only thing that saves you from your own past chaos.
My first boss called my single-file project a "digital hairball." He made me rewrite it into modules before he'd even look at the code. It was annoying then, but it taught me structure the hard way.