In our coding challenges, we present a "hint" for each steps, which is a bit of code with blanks, and it's up to them to figure out where that code fits in the current program and what will go in the blanks.
For example, here's a hint from our very first challenge, which gets them to use the rect() command to form an H:
The goal is for them to learn by doing - to get a general idea of what we want code want them to produce, and to tinker until they figure it out. The hints vary in each challenge in how much they reveal, but there is always some structural hint to guide them.
In reviewing the challenge feedback form (which automatically records the students' code when they report a problem), I noticed many students had clearly copy-pasted the hint code. I can tell that from tell-tale missing arguments, wherever a blank had been - like "rect(,70,60,50)"
.
With invalid JavaScript like that, students would immediately see an "Oh noes!" syntax error and have to work out what it meant. Oftentimes, those syntax errors are not particularly newbie-friendly (which is a problem for another day!) and that can really throw a student off.
We had two possible solutions:
- Smart copy/paste: We could probably hack it so that when you pasted a blank, you'd get a comment instead, or we could change the editor to have a placeholder and disable syntax errors. We would still need to explain what comments were or what those placeholders were for.
- Disable copy/paste: If we disabled copy/paste, they would be forced to type it in, which would mean they would encounter our more sensible messages that remind them of the proper arguments for that function (instead of the more nonsensical confused syntax error). It also means they would have to take the challenge more slowly, and think about what it was they were typing. Though I can't find any research in the programming space, there is research in the note-taking space that manually typing increases learning more than copy/pasting, due to the extra attention it requires.
Well, we're all about increasing learning here, so we went with the latter option, using the CSS user select property on the code. Yes, they could be savvy and inspect element to get that code, but it is highly unlikely that our beginning students will do that, and they are who we want to do the most learning.
Now, we're not against copy/paste everywhere - once you understand code, you can be quite productive when you learn how to find the most similar code to what you want, and then copy-paste-and-modify. But that's not the skill we're testing in the challenges, and we think it's worth it to make them go through the effort to type syntax that is only marginally familiar.
If anyone has done research or your own experiments to study the effects of typing versus copy/pasting when learning code, we'd love to hear about it.