# Referencing Code¶

Just as you must cite your source when writing a research paper or creating a presentation, you must cite any code you reference while programming.

1. When should I cite my code?

According to the Academic Integrity at MIT guidelines for writing code, you should cite your code when:

1. You directly copy any length of code from an external resource
2. You “paraphrase” or slightly modify code that you copy from an external resource
2. How do I cite my code?

Academic Integrity at MIT also provides some tips on how to cite your code from another source:

1. Always include the URL and date of retrieval. You may consider including additional details to clarify the source.
2. For modified code, include phrases such as “Based on:” or “Adapted from:”
3. Ask your teacher for specifications to ensure you are following proper formatting and meeting all class requirements
4. If you use Open Source Software click here for more details.
Below are useful templates for citing code provided by the University of Arkansas:

## Citing Code in Written Report¶

Format: <author(s) names> (<date>) <title of program/source code> (<code version>) [<type>]. Web address or publisher.

Example: Smith, J (2011) GraphicsDrawer source code (Version 2.0) [Source code]. http://www.graphicsdrawer.com

## Citing Code in the Source Code¶

Format: Place the information as a comment above the code you want to cite. The examples below use Python commenting format. You can also insert your citation as a comment in Scratch or a comment in App Inventor.

""" Title: <title of program/source code>
Author: <author(s) names>
Date: <date>
Code version: <code version>
Availability: <where it's located> """


Example:

""" Title: GraphicsDrawer source code
Author: Smith, J
Date: 2011
Code version: 2.0
Availability: http://www.graphicsdrawer.com """

Next Section - Chapter 22 - Global Impact