28
Rant: I used to write code all in one giant block like a monster
Honestly, I was that person who would write a 200-line Python script with zero functions. I thought breaking things up was a waste of time. Then my buddy showed me his code from a project we worked on together last semester. He had split it into tiny functions with clear names like 'get_user_data' instead of my jumbled mess. Took me about 2 hours of refactoring my own stuff to see how much easier it was to fix bugs. Now I do that for everything. Has anyone else had a similar moment where you realized you were making things harder for no reason?
3 comments
Log in to join the discussion
Log In3 Comments
annas8713d ago
My old code was basically one giant function called 'main' that did everything... even made the coffee if you asked nicely. Breaking it up felt like admitting defeat at first but it's so much easier to find where you messed up. Took me way too long to learn that lesson honestly.
8
allen.ivan12d ago
Yeah that whole "one big function feels cleaner" thing is just how our brains trick us. Same reason my garage has piles of tools everywhere because "putting them away is too much work" but then I spend twenty minutes digging for a screwdriver every time. Breaking things up always feels wrong until you actually need to fix something, then it's the only thing that makes sense. I think we all learn this eventually, just some of us after a lot more pain than others.
10
ray80112d ago
Nah, I actually miss the old spaghetti code sometimes. One giant function meant you could FIND everything in one place without jumping through 15 files.
3