Tuesday, May 10, 2016

Copying Code–Steal from the Best

Not every coding mistake makes it into the news but one did recently which carries a cautionary message for students (and others who code.) Nissan app developer busted for copying code from Stack Overflow  It’s funny in a way. It’s not so gunny in other ways.

Long story short, a developer copied some code from the website Stack Overflow where many developers help out with code samples, hints, tricks and other information. It’s likely no one would have noticed if they hadn’t included that revealed the source of the code. That’s the funny part. The not funny part is that this was not caught in the review process for code entering the product.


Now it’s been a long time since I wrote code that shipped in a commercial product but back then code did not make it into the official build without being reviewed by two other developers. One would like to think that this sort of process still exists and that people actually read the code. I know I always read code I was asked to review very closely.

Reusing code is a perfectly acceptable practice in professional development. We even used to joke that one should “steal from the best.” But of course one is always expected to fully understand the code one is reusing.  Students share code all the time as well. This can be a problem for teachers since projects are assigned (at least in part) to determine what students have learned. So a student who uses code they don’t understand is really cheating. They are cheating themselves but they are also devaluing the grades. Both are sad really.

Students have been copying from classmates for years. Well probably for as long as we’ve had grades. Copying from the Internet is newer but seems to be growing in frequency. Often times this is easier to spot as code shows up that is very different and even beyond what has been covered in class. Other times it is not as easy. I don’t always have a problem with this. If the student really understands what they are using getting code from the Internet can be a good thing. When they use code without understanding it problems ensue.

Often I see students using code from the Internet because they don’t understand it well enough to incorporate it in with the code that they have written themselves. This can be a good learning experience.

Generally I think reading the code written by other people can be a very good thing. I know I learn a lot from that process. The only time it really is a problem is when students don’t actually learn from it.


Algot Runeman said...

At the very end of the article you linked, the author warned everyone to NOT issue a curl command which ended piping something through bash.

I suspect that serves as a perfect example of "understanding the code."

However, would the disaster happen for students using a standard Windows CMD environment?
Is it "telling" that the story depends on a GNU/Linux/OSX/Unix environment?

Bob I said...

Scratch has a thing where you can "see inside" anything on their website, then drag a script into your "backpack", and reuse it in your project. I show it to kids with the warning that I will ask them to explain their code to me. I also say that it's better to use something simple that you understand than something amazing that they don't!

Alfred C Thompson II said...

Algot, yes that the article assumed a GNU/Linux/OSX/Unix environment was very interesting. I also wonder how many people who don't know what it does tried it to find out.