Thoughts on copying and pasting code? 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.


Copying code you found somewhere in docs or on the internet and pasting it into your code
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?
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