10
$\begingroup$

I'm curious to hear people's experiences with allowing (or disallowing) students to use copy and paste in code when learning as beginners.

I feel like there are two kinds of copy/pasting.

  1. Copying code you found somewhere in docs or on the internet and pasting it into your code
  2. Utilizing copy paste with your own code to write similar code more quickly

I see some upsides and downsides to both, so I'm wondering what other instructors have learned.

e.g.

  • Upside to allowing it. It's a useful tool for moving quickly and everyone who writes code professionally would use it.
  • Downside: students who are beginners could really use the practice typing everything out
  • Downside: it makes it much easier to copy code you find somewhere without needing to understand it.

What are other instructors' experiences and insights? Do you allow your students to use copy and paste?

$\endgroup$
  • $\begingroup$ This question should not be closed; it is asking for how folks think through their copying policy on labs. It certainly falls under good subjective in my book. $\endgroup$ – Ben I. Jun 16 '17 at 1:24
  • $\begingroup$ Professionals should not be copy-pasting random code - this has all sorts of licensing and copyright implications. $\endgroup$ – Sean Houlihane Jun 16 '17 at 14:01
  • $\begingroup$ Sean, sorry to be unclear here -- all I meant by that is that professionals copy from within their codebase all the time -- for example, when I'm making a new page on our website that's similar to a page we already have, I start off by copy/pasting the other page and making changes--in any case, this is all also part of the fuzziness and clarity that I think needs to be discussed and taught to new programmers. $\endgroup$ – Zach Galant Jun 16 '17 at 16:03
6
$\begingroup$

I let the kids cut and paste code but with the following caveats:

  • They must cite the source (be it a classmate, another student or a site like StackOverflow)
  • There has to be enough of their project that is their own code to show mastery of whatever the assignment's all about
  • At times, I encourage them to use others code (and libraries) to enhance their projects, that is, add features that they otherwise wouldn't have had
$\endgroup$
  • $\begingroup$ I'd add the caveat that if the assignment is to "write code that does X" they can't go acquire code that does X for them. E.g. if the assignment is to write a bubble sort function, they shouldn't be hitting up Stack Overflow for "bubble sort [language]." If a section of the assignment can be completed by utilizing code written earlier in the semester, then getting that segment off SO is fine too (I certainly can't write a merge sort algorithm from scratch, but I need one for project Y, so why not grab it from somewhere else?). $\endgroup$ – Draco18s Jun 22 '17 at 18:15
4
$\begingroup$

In my class, the only rules I set are that kids may not give code to each other, either directly or indirectly. I also set a "rule of thumb" that if student A needs help from student B on a portion of a lab, student B must have finished that portion, and may look at student A's (relevant) work, but that A may not look at B's work.

Part of the logic here is that I already consider labs to be "suspect" with regards to plagiarism, so the giant brunt of their grades come from tests and quizzes. The labs, then, are primarily a tool that the kids should use to prepare for the assessment. I explain this to them often, and point out that not fully understanding their own lab is a great way to shoot themselves in the foot.

$\endgroup$
  • $\begingroup$ I have few students, and their styles are very distinct, so when they 'help' each other, usually it is very obvious. But what tends to happen is the one seeking help develops more understanding over time, and the who thought they knew lags behind. It is a long curriculum, so I mostly just let it unfold. $\endgroup$ – user737 Jun 17 '17 at 13:02
4
$\begingroup$

I think it is fine, as long as it isn't an essential part. It saves time, and the students can learn from professionals, and can learn new ways of doing something that they never would have thought of. Also, it helps you become a more efficient coder, and if you borrow someone else's functions that is more efficient it makes the rest of your program faster, and it saves a lot of time that could be spent on the main goal, not just some function that was already created before. Don't reinvent the wheel!

$\endgroup$
1
$\begingroup$

I don't think that student learn that much from just running someone else's code without going through it.

Copy & pasting can be really useful for sharing code that has been deliberately 'broken': you can demonstrate / explain code that is working and then introduce deliberate mistakes for students to find and fix when they copy / paste.

That way they get the speed advantages of copy / paste but they also have to engage their brains whilst getting experience debugging.

Alternatively, you can give students code to copy that they then have to comment / adapt / extend.

$\endgroup$
0
$\begingroup$

Item #2, a form of code re-use, especially if it is tested known working lines of code, is usually considered to be a good software engineering practice.

Copying a line or two from the official documentation might in some cases be considered the proper way to learn or to code. Some professional IDEs do this automagically in the auto-complete hints.

Copying from a web search or stackoverflow requires supervision or auditing. The instructor needs to confirm that the student understands (what it does, the algorithm, etc.) and has checked what they are copying against more official (for the language, library, etc.) documentation.

$\endgroup$
0
$\begingroup$

I'm late to the discussion, but here are two reasons against copying and pasting code:

  1. I believe something is lost when you simply copy and paste code. They say that to learn a definition of a word, you read it, say it, and write it. So I think typing code definitely adds value, especially when IDEs like Eclipse have autocomplete and syntax checking. Typing is a learning experience.
  2. Unless you are copying from a raw format, copy and paste could bring in invalid characters. For example, try copy and pasting "hello world" from Microsoft Word to your favorite code editor. You'll see invalid double-quote characters pasted.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.