The reuse of code can be seen as good practice but copying other peoples computer code without citing it correctly may be a plagiarism violation. It is not always clear how to correctly reference programs and source code. The information on this page explains how to cite programs and source code correctly within reports and in the source code itself. Remember, your professor is the final expert in this matter. When in doubt, consult.
As a programmer it can be difficult to to know what resources need to be cited and what resources don't. Generally, if you used a function or algorithm that you did not create and it came from someone else then this should be cited so as to give the creator credit. Ideas and programs that are "common knowledge" do not generally need to be referenced or cited. If there is only one way to program for a specific task and this is so commonly used then it may not need to be cited. 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"); } }
If you are unsure about whether a section of code that you are using needs to be cited then you should ask your professor. They will be able to advise as to what you should do.
An added benefit of citing correctly is that it makes your code easier to maintain.
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)
- Web address or publisher (e.g. program publisher, URL)
When writing a report and citing within the text, the following method (based on common IEEE and ACM citiation rules for other types of references) can be used:
<author(s) names> (<date>) <title of program/source code> (<code version>) [<type>]. Web address or publisher.
Smith, J (2011) GraphicsDrawer source code (Version 2.0) [Source code]. http://www.graphicsdrawer.com
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)
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