View on GitHub

ixd-resources

Resources & Information for IXD

Citing Code

Pablo Picasso once said “Good artists copy, great artists steal.” More to the point for our class, Cameron Moll rephrased it—”Good Designers Copy, Great Designers Steal”

A great way to learn design and code is to look under the hood of a website to see how it was made. With a click of the mouse, we can inspect the code and see exactly what the designers and developers did to create the look/effect/design before us. We can even copy that code and paste it into our code editor to manipulate it and make it do what we want for our site.

To a degree, there is nothing wrong with ‘borrowing code’—we all borrow great ideas from others. Think about the last essay you wrote; you probably put a quote in there because you thought “Dang! That person said it so perfectly!” You didn’t come up with it, but you used it. And you quoted it (and cited it).

When we code, we should cite the source we used, just like any essay we might hand in for grading.

When should I cite a source in my code?

How should I cite the code?

HTML

<!-- start of code from https://example.com/code.html -->

<header>
	<h1>This code is not mine</h1>
	<img src="/images/citation.gif" alt="citation example"
</header>

	<!-- end of code from https://example.com/code.html -->

HTML citation example

CSS

	/* start of code from https://example.com/code.html  */
	
	.cited:nth-child(1) {
		color: red;
		font-family: Helvetica, Arial, sans-serif;
		background-image: url(/images/citation.gif);
	}
	
		/* end of code from https://example.com/code.html */

CSS citation example

Javascript

// start of code from https://example.com/code.html 
function doNotCheat() {
    alert("I cited my code");
}

// end of code from https://example.com/code.html

javascript citation example

List all code sources and the sources of any images that are not your own in a PDF file submitted to Slate along with your assignment.

Even if you do not copy the code verbatim, you must still cite where concepts/references came from. Indicate “Adapted from:” or “Based on” so it is understood that you made changes to the original code.

If you use Open Source code or public libraries, you should still properly cite the source and follow the terms of any licensing that applies to the code you are using.

Pro Tips

Although it is common practice to adapt code examples found on the web,

For more information on Academic Integrity, visit Academic Integrity for Students

Some content adapted from https://integrity.mit.edu/handbook/writing-code