Skip to Main Content

Cyber Security: Referencing for Computer Science

Referencing for Computer Science

For how to do APA 7th referencing in general please see the ECU Referencing guide

The following are some suggested examples not covered by the guide. These are adaptions of the rules of APA 7th and are only suggestions on how to include all the relevant information for the referencing. Please check with your lecturer or tutor on how they prefer you to show your references first. 

Referencing Code

When to reference code

If you have to reuse or showcase any code that you have sourced from somewhere else (so something that you did not write yourself) you need to reference the code. 

Please check with your lecturer before reusing code. The following is a guide on how to reference code but it should be used sparingly. Check with your lecturer and assignment instructions on how they prefer you reference code or what you should reference. They may have a distinction between guides and someone else's work. 

Within a written assignment

Referencing code inside an assignment is the same as referencing an image or quotation.

When using a screenshot

If you have screenshotted code reference it like an image: See our Figures, Tables, & Images guide

 

When quoting a snippet of code in text

Reference this like a quotation: See our section on Direct Quotations

... it is a good test for evaluating whether or not candidates can identify logical hierarchy when writing looping statements. If the following statement isn't included in the first logic test the game will not work:

if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0; 

print("fizzbuzz");

(W3resource, 2021)

Include a citation below the snippet similar to a block quote no matter how many words/characters you have. 

Adapted from Massachusetts Institute of Technology, (n.d.) Writing Code. https://integrity.mit.edu/handbook/writing-code

When to reference code

If you have to reuse or showcase any code that you have sourced from somewhere else (so something that you did not write yourself) you need to reference the code. 

Please check with your lecturer before reusing code. The following is a guide on how to reference code but it should be used sparingly. Check with your lecturer and assignment instructions on how they prefer you reference code or what you should reference. They may have a distinction between guides and someone else's work. 

Within your program

If you need to reuse or work with some code you have taken from another source you must give credit in the code. This includes adapting parts of the structure or even using the structure with your own variables in it. If you have created it based on documentation, unit materials or guides, textbook examples, or other supporting documentation found online then check with your lecturer to see what they prefer you to do with referencing, or if they would prefer something simpler than the example below.

The following example is only a suggestion. Please provide credit such that the original source can be identified. 

Use comments before the function to include all the details about where the function came from. Include all the basic elements of an end-text reference (lines 2-6 in the image above). 

Things to include:

  • Title for the function
  • From / Adapted from Title of the program/site it came from
  • Software version if available
  • URL to site if available
  • Copyright statement with Year and Author
  • Provisions of use 

Disclaimer: this function is only copied as an example. Please don't use a whole function unless explicitly instructed to. 

Adapted from Massachusetts Institute of Technology, (n.d.) Writing Code. https://integrity.mit.edu/handbook/writing-code