Skip to Main Content

Technology & Computing

A research guide to resources in technology & computing

Document Code Responsibly

Overview

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.

Objectives

By the end of this guide, you will be able to:

  • Differentiate between code that needs to be cited vs. what counts as "common knowledge"
  • Apply good citation practices to both written reports and in-line in your source code

Please Note

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.

The information in this guide was reused and adapted with permission from The University of Arkansas University Libraries: https://uark.libguides.com/CSCE/CitingCode 

Knowing When to Cite

When should I cite my code?

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 directly copy code that you did not create. You need to give credit to the original developer.
  • You copy code and adapt it. In this case, you are still not the original developer and should give credit to the creator. 

You do not necessarily need to cite ubiquitous or "common knowledge" code.

What counts as common knowledge?

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");
      }
}

Who do I consult if this distinction is unclear?

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.

What about open source code, software, or projects?

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.

Citing in the Source Code

Information Needed

To cite either a computer program or piece of source code you will need the following information:

  • Author(s) name (Individual or corporation)
  • Date
  • Title of program/source code
  • Code version
  • Type (e.g. computer program, source code)
  • Availability (e.g. program publisher, URL)

Format

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

Citing in a Report

Information Needed

To cite either a computer program or piece of source code in an APA style report, you will need the following information:

  • Author(s) name (Individual or corporation)
  • Date
  • Title of program/source code
  • Code version
  • Type (e.g. computer program, source code)
  • Web address or publisher (e.g. program publisher, URL)

Format

When writing a report and citing within the text, the following method can be used for an APA style report or paper:

  • Format: LastName, FirstInitial. (Date). Title of program/source code/software (code version) [type]. Web address or publisher.
  • Example: Smith, J. (2011). GraphicsDrawer source code (Version 2.0) [Source code]. http://www.graphicsdrawer.com