8
Can we talk about the talk I had with my cousin about loops?
My cousin is learning to code and he asked me last Sunday why I always write out the same block of code like 10 times instead of using a loop. He's been studying Python for about 3 weeks now and he pointed at my screen and said 'dude that's just lazy programming.' It hit me hard because I've been doing that for like 2 years, just copy pasting stuff when I get stuck. He showed me how he rewrote one of my little projects with a single for loop and cut 30 lines down to 5. I felt pretty dumb honestly because I always thought loops were too complicated to bother with. Now I'm going back through my old files and redoing them all with loops. Has anyone else had a beginner show them something simple that you just never learned?
4 comments
Log in to join the discussion
Log In4 Comments
the_thea16d ago
It's wild how often that happens in life, not just with coding. I noticed the same thing when my neighbor, who just got into gardening, showed me how her little tomato plants were doing better than mine because she actually looked up the right soil mix and I was just dumping whatever bag was cheapest. Like, I'd been doing it wrong for years and she figured it out in a weekend. Makes you wonder what other shortcuts we're all walking right past.
7
murray.drew16d ago
My neighbor did the same thing with houseplants last year. She googled the right light and watering schedule for each one, while I was just watering everything on the same day. Her plants exploded with growth, mine just sat there looking terrible. How did you figure out that you were the one doing it wrong and not just unlucky? Because that's the part I still struggle with, knowing when to change my approach.
3
drew_reed6216d ago
Oh man, this hits home. Same thing happened to me with cooking like 2 years ago, I was just throwing random spices into everything and wondering why it tasted weird. My buddy spent an afternoon looking up proper ratios and suddenly his food was restaurant quality. Honestly, once I saw how much better things turned out with just a tiny bit of research, it clicked that I was the common denominator.
6
the_max16d ago
Thirty lines down to five with a for loop. That is a neat trick for sure, good for your cousin. But honestly, being stuck on copy pasting for 2 years doesn't sound like some big failing to me. It worked, right? Your code ran. People get real dramatic about stuff being "lazy programming" but unless you're getting paid by the line or running a huge server farm, who really cares if a script is 30 lines instead of 5. It's still just a tool that does a job. Plenty of people write messy code their whole lives and never have a problem. Your cousin is 3 weeks in, he's still in the phase where everything is exciting and new. Give it a year and he'll probably be copy pasting stuff too when he just wants to get it done on a Tuesday night.
1