Harvard Templates
Programming
Examples
We don’t provide a specific template for computer code, as how you reference this depends on the code’s source and how you are using it.
You should reference computer code in both your written work and coding work using the template for the source material where you found the code. The most common sources of code are:
Written assignments
If you quote or refer to code within a written assignment, you should provide an in-text citation and a full reference within your reference list at the end of the piece of work. Examples of citations and reference list entries are included in the templates for each source.
Coding Assignments
You also need to reference any code which you reuse or adapt within your own coding work. You do not need a separate citation and reference list, but you should include the full reference in an inline comment in your code to indicate the section of code that you have reused. Your reference should follow the format laid out in the relevant RGU Harvard template for the source of the code (see above).
If you modified the code when you reused it, include the words “Adapted from” or “Based on” before your reference to indicate this.