21.7. 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.
When should I cite my code?
According to the Academic Integrity at MIT guidelines for writing code, you should cite your code when:
You directly copy any length of code from an external resource
You “paraphrase” or slightly modify code that you copy from an external resource
How do I cite my code?
Academic Integrity at MIT also provides some tips on how to cite your code from another source:
Always include the URL and date of retrieval. You may consider including additional details to clarify the source.
For modified code, include phrases such as “Based on:” or “Adapted from:”
Ask your teacher for specifications to ensure you are following proper formatting and meeting all class requirements
If you use Open Source Software click here for more details.
21.7.1. 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
21.7.2. 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> """
""" Title: GraphicsDrawer source code Author: Smith, J Date: 2011 Code version: 2.0 Availability: http://www.graphicsdrawer.com """