We often associate plagiarism with traditional writing---papers, essays, etc. However, computer code is also a type of writing. While the reuse of code can be seen as good practice, copying other peoples' computer code without citing it correctly may be a plagiarism violation.
While it is not always clear how to correctly reference programs and source code, the information on this page will explain how to cite programs and source code correctly within reports and in the source code itself.
By the end of this guide, you will be able to:
In the context of your course, your instructor is ultimately whose guidance you should follow in this matter. For some assignments, copying or adapting existing code may be expected whereas other assignments may require you to write something original. When in doubt, re-read your assignment instructions and/or reach out to your instructor to ask about assignment expectations.
As a programmer it can be difficult to know what resources need to be cited and what resources do not. Generally, you should give credit when:
You do not necessarily need to cite ubiquitous or "common knowledge" code.
Ideas and programs that are "common knowledge" do not generally need to be referenced or cited. For example, if there is only one way to program for a specific task.
A good example of this is a "hello world" program such as the following (in Java):
class HelloWorld { public static void main (String[] args) { System.out.println ("Hello World"); } }
If you are unsure about whether a section of code that you are using needs to be cited then you should ask your instructor. They will be able to advise you in this matter.
When using open source software, you should still provide attribution, as well as follow the terms of use as outlined by the creator. The license for the code is often included in the download.
To cite either a computer program or piece of source code you will need the following information:
When citing within the code, the citation information could be placed as a comment above the reused code, as shows below:
/***************************************************************************************
* Title: <title of program/source code>
* Author: <author(s) names>
* Date: <date>
* Code version: <code version>
* Availability: <where it's located>
*
***************************************************************************************/
e.g.
***************************************************************************************/
* Title: GraphicsDrawer source code
* Author: Smith, J
* Date: 2011
* Code version: 2.0
* Availability: http://www.graphicsdrawer.com
*
***************************************************************************************/
(Version 2.0) [Source code]. http://www.graphicsdrawer.com
To cite either a computer program or piece of source code in an APA style report, you will need the following information:
When writing a report and citing within the text, the following method can be used for an APA style report or paper:
This work is licensed under a Creative Commons Attribution 4.0 International License.