Codes, short for "source code," are programming languages that make up computing software, applications and much of the online environment. Like publishing a book, writing code is considered to be intellectual labour and is protected by copyright. Most often copyright refers to the code used to create commercial software.
A computer program, including its source code and object code, is capable of copyright protection if it is an original, fixed work. If the form and content of the computer program is predetermined by its function, the work may not be entitled to copyright protection. If the computer program is protected by copyright, the unauthorized copying of that program, in whole or substantial part, would be infringing unless an exception or user’s right applied, such as Fair Dealing. Section 30.6 of the Copyright Act also contains specific exceptions from infringement relating to computer programs, including exceptions for the purposes of interoperability, encryption research, and security.
Open Source refers to code, most often for software, that anyone can inspect, modify and enhance because its design is publicly accessible. To be considered "open source" the code must adhere to a licence and must do the following: be technologically neutral (e.g. only for windows); allow modifications and derived works; and cannot restrict other software.
Most licences will provide boiler plate notices that you can include in all copies or significant portions of your software. Above is an example of GNU GPL License.
According to MIT's Academic Integrity guidelines around writing code, best practice is to "always duplicate the [open source code] copyright in your code, and/or store the license in a file with the code" regardless of whether the licence requires attribution or not.
To cite either a computer program or piece of source code in a formal paper, you will need the following information:
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
The text above is adapted from "Citing Programming Code", Computer Science & Computer Engineering Resources (University of Arkansas) . See the same source to learn how to cite computer code in the sources code.