The Dangers of Copy-Pasting Code: My Debugging Story

Bennett Garner
5 min readApr 30, 2019
The workflow of a typical dev — search Stack Overflow for the answer…

Tutorials and Stack Overflow code are super useful, until you stop understanding what they’re doing.

This happened to me this past week, and I spent an agonizing few hours debugging a relatively simple issue in my Django application.

Since I had copy-pasted from some authoritative sounding tutorials online, I didn’t understand what was happening when I ran into an error.

This quick post is my word of warning: If you’re copy-pasting code you don’t understand, then you’re in for a bad time.

Copying en masse

In my application, I wanted to implement basic user registration and sign-in, but enable customization of the forms and add email activation on registration.

The solution was to use a combination of Django’s built-in auth along with an open-source tool called django-authentication.

I glanced at the documentation for both and then started hacking toward the desired outcome. And I got really far with my own intuition and code samples online.

This applies to nearly any coding problem, not just Django. You’ll likely get most of the way there with tutorials and code samples, but those are dangerous waters if you’re copying too much or code that’s too complex.

--

--

Bennett Garner

DeveloperPurpose.com — Build a coding career with meaning and purpose 💻 Top writer in technology ✍️