V
11

My buddy the senior dev told me to stop overthinking and just copy paste sometimes

I was stuck on a regex pattern for like 2 hours yesterday and nearly tossed my laptop. Called up my friend Mike who's been coding for 12 years and he straight up said "dude just grab a snippet from Stack Overflow and tweak it, nobody's grading you on originality." It hit different because I always felt like copying code was cheating or whatever. But he's right, even pros reuse stuff all the time. Now I spend 20 minutes max on a problem before I go looking for a working example. Has anyone else felt guilty about not writing everything from scratch?
3 comments

Log in to join the discussion

Log In
3 Comments
daniel_cooper34
The guilt fades once you realize even the best devs copy paste from their own old projects half the time. Just make sure you actually understand what the snippet does before you drop it in production.
2
wren230
wren23019d ago
That's funny, I still remember the time I copy-pasted a sorting function from my own code from like two years ago and it worked perfectly until someone passed it an empty array. Spent three hours debugging before I realized past-me wrote it for a specific dataset that never had zero items. Now I just put a docstring on everything that says "this WILL break if X happens." It's stupid simple but saves me from my own past self constantly. Jordan's sticky note idea is actually smart, might steal that for the edge cases I always forget about.
1
jordan_henderson13
Taped a sticky note to my monitor that just says "does this actually handle errors or is it just my old spaghetti?" Saved me a few times when I reused some file upload logic that totally broke on bigger files (embarrassing debugging session). Made a personal snippets folder organized by what the code actually solves, not what it's called. That way when I grab something I know it's tested in a real project and not just some half-baked experiment I forgot about.
-1