O
19

That time a senior dev showed me my code was a mess in 5 seconds flat

I was stuck on a Python script for 2 days at this internship in Austin. A senior dev named Marcus glanced at my screen for maybe 5 seconds and said 'you're nesting too deep, just break it into functions.' Fixed it in 10 minutes after that. Has anyone else had a quick comment from someone that totally saved your project?
3 comments

Log in to join the discussion

Log In
3 Comments
sarah531
sarah53128d agoMost Upvoted
2 days is rough, but honestly that "break it into functions" advice applies to almost everything in life. I've noticed the same pattern when I'm packing for a trip - trying to fit everything into one suitcase is a mess, but splitting it into a carry-on and checked bag instantly makes it manageable. Marcus basically gave you the universal shortcut for untangling overcomplicated systems.
8
lunakim
lunakim28d ago
Hmm, actually the carry-on plus checked bag isn't exactly the same as functions, @sarah531... they don't call each other.
7
amy_murphy85
Breaking it into functions sounds great until you have 30 tiny functions scattered across files and you can't even follow the flow anymore. I've seen projects go from one messy file to ten messy files that all call each other in circles, and somehow it's worse. Deep nesting is annoying but at least you can scroll through one place and see the whole thing. Splitting things up without real planning just creates a different kind of headache, especially for someone new. Why not just learn to read nested code better instead?
1