The Danger Zone Of Becoming A Cut-And-Paste Coder
Yesterday, I asked myself a question, “Could you pass a coding exam?” A lot of companies administer a coding exam before hiring someone as a software engineer. This makes sense. You want to make sure that the new hire actually knows how to code.
You may wonder why a new hire software engineer would not know how to code. Well, for years, many graduates of computer science programs didn’t know how to code.
Stories of this problem were circulating even 15 years ago. Today, with the popularity of “vibe coding” the probability of becoming a coder who can not code is even greater.
I could feel myself slipping into the danger zone of becoming a cut-and-paste coder, and I knew I didn’t want to go over to the bad place.
How To Become a Cut-And-Paste Coder
Here is the path to becoming a cut-and-paste coder these days. When you’re trying to make something, just grab the following:
- A little code from CodePen
- A little code from Stack Overflow
- A little code from your textbook
- A little code from ChatGPT
- A little code from old assignments
- A little code from some code snippets you’ve saved
Then throw something together, and hope it works.
The danger of doing this is that you never quite understand how things work. You know how to paste them together, but you don’t know how to create them from scratch. If someone left you in a room alone and asked you to do it, you probably could not.
I’m not sold on the idea that AI will do all the coding in the future. I believe that the future belongs to people who know how to code.
After I realized that I was in a coding danger zone, the next step was to implement some new policies to get myself out.
Turn off the Wi-Fi
For my next assignment, I turned off the Wi-Fi until I was done. Why? Many assignments can be completed without the internet and it cuts you off from the supply of cut-paste-opportunities. I decided to tackle a coding problem using only my textbook and my brain. This technique cuts you off from running to ChatGPT for help as usual. It was great. It felt like I’m now on my way to becoming a real coder who understands how things work.
Instead of Asking It To Code, Ask ChatGPT To Explain Things Or To Find Typos
I got this wonderful advice from Rob Miles. You can read his full article on The Proper Use of ChatGPT here. Don’t ask ChatGPT, “How would you code this?” But when you’re done coding the thing, you can show ChatGPT your code to find the error in it causing it not to work. This is usually a missing semicolon or some other typo.
Ask Sourcegraph, “What Are The Most Common Mistakes You Are Finding In My Code?”
By using Sourcegraph, you can get an idea of the most common mistakes you are making. Recently I did this after two Sourcegraph sessions. Here are the ten most common mistakes I was making in my coding. A little embarrassing to share, but I will share it anyway.
Missing closing tags/brackets
Example: <button onclick="displayPicture1();">Picture 1</button (missing closing >)
This prevents proper HTML parsing and can break your page structure
Incorrect nesting of elements
Example: Placing <button> elements inside <audio> tags
Elements should be properly nested according to HTML semantics
Unclosed HTML elements
Example: <audio> tags without closing </audio> tags
All non-self-closing HTML elements need proper closing tags
Missing variable declarations
Example: alarmsound = document.getElementById("alarmSound") without var
Variables should be properly declared with var, let, or const
Poor HTML structure
Example: Not grouping related elements (like buttons) in container elements
Good structure improves readability and maintainability
Missing error handling
Example: No handling for audio playback failures
Error handling helps identify and troubleshoot issues
Incorrect method names
Example: Using getElementId instead of getElementById
JavaScript methods must be used with their exact names
Missing quotes around string identifiers
Example: document.getElementById(statusPhrase) instead of document.getElementById("statusPhrase")
Element IDs need to be in quotes when used as string literals
Script tag misuse
Example: Using both src attribute and inline code in the same <script> tag
When using src, the content inside the script tag is ignored
Incorrect string concatenation
Example: alarmsound = "document.getElementById("alarmSound")
Mixing quotes and JavaScript code incorrectly
Resist The Temptation To Speed Through Your Coursework
Remember that you are learning a brand-new skill. Not only are you learning a brand-new skill, you are learning a new skill that is notoriously hard to learn. That is why most people don’t try to do it. It’s because it is hard. Let me just repeat. Coding is hard.
There is a tendency to say, “I have to learn this fast so I can get a coding job.” But that leads to racing through the course content, and racing through the content leads to not really understanding anything.
Be willing to read content twice. If you are learning from videos, be willing to watch the video twice. Slow down.
Get Into The Habit of Recreating Things From Scratch Using The Raw Materials of Your Own Brain Cells
If you are also in the cut-and-paste danger zone, one day, just sit down and try to do something from scratch. It doesn’t have to be some big, long project. It could be something like what I’m going to do tomorrow: Make a clock that ticks and supplies the current time, or make a small 4-picture slideshow. See how well, you can incorporate what you’ve learned in previous classes.
You may be wondering, “Why should I use my own brain when there is a wealth of information out there to help me?” After ChatGPT showed up, I also thought, “Great, I’ll never have to think another thought again. It’ll be awesome.”
However, here’s the problem with that approach. On that day, when they shut you in a room and ask you to do the coding exam and tell you that you have 60 minutes to complete it, a little surprise awaits. Googling answers takes time. You won’t be able to finish it in 60 minutes because you’ll spend time googling every answer and looking for code to cut-and-paste.
However, if when that day comes, you are relying on the expertise in your own head, you’ll be able to complete the exam in the allotted time.
The Real World Needs People With Real Expertise
The number one reason to step away from the danger zone is to acquire real expertise. The world needs people who can go deep on a topic. I would like to be in the “can do it from scratch crowd.” I have already decided I don’t need to learn every framework out there. But for the 6 I’ve decided to learn, I’d like to thoroughly understand what I am doing.
Now, that I’ve decided to step away from cut-and-paste coding, ideally the next few weeks of completing coding assignments and challenges will look like this
- Read (If video, watch)
- Re-Read (If video, re-watch)
- Ready to try
- Redo
- Recreate from scratch without cut-and-paste help
That’s the escape strategy.
I hope that this helps someone else who is in the danger-zone of becoming a cut-and-paste coder.