Should You Be Copying That Code?

2 min read

\"Copy\"

 

Let\’s be honest: Even after your undergraduate degree, the majority of an entry-level developer\’s time is spent Googling how to get that code to work and aimlessly copying and pasting snippets from across the internet. You finally get the damn thing to work, but did you learn anything in the process?

I have definitely been the culprit of copying and pasting code without much scrutiny. In a rush to meet deadlines, I scroll through the blocks of text to get to the goods. I have yet to be burned by a stray

rm -rf

(or equivalent malicious code) by some jerk but that could brick my machine!

I\’ve learned that when I research online, it helps most to look at the big picture rather than just skipping to code blocks. I try to learn by following someone\’s thought process. How efficient is this solution? Why did they choose it? Is it even worthwhile? Over my first year in the industry, I\’ve gotten slightly proficient in discerning whether someone knows what they are talking about. It takes time.

When you are working on a project, it\’s important to follow the old adage of not reinventing the wheel. However there are a couple exceptions to this rule:

  1. Unless otherwise stated, the code on your homework exercises should be your own.
  2. You have a moment to dig deep into exploring your language of choice. For example, I\’ve loved sometimes abstaining from JQuery and finding the pure ECMAScript way of life. I sometimes do things that few people do in pure Javascript, and that forces me to learn from ideas and taking a shot of dealing with implementation from scratch. This means I cannot look for an exact answer!

Caution!

When you work on an assignment in school, it is tempting to copy entire code blocks, but take extreme caution. On a simple coding assignment testing your knowledge of syntax and algorithms, you will inevitably get busted for plagiarism.

In the end, I\’ve found that I\’ve learned the most from perusing documentation. I\’m lucky to be working mainly with Javascript using Sencha frameworks with some C# here and there, which all have excellent documentation. For the beginner, documentation can be scary and dry, but all of them follow common conventions which allow for quick get-in-and-out reference. Learning to love documentation is a must!

CC BY-SA 4.0 Should You Be Copying That Code? by Nicholas Lash is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.