academic-integrity-v2

Chapter 3: Copying Code from Documentation

Documentation used while coding is the equivalent of a dictionary used while writing an essay. It provides insight and/or snippets of individual commands, not a larger concept. Documentation may provide insight on:

Copying from documentation usually involves only copying a few lines of code at a time. The copied code will not function in its copied state; it will need to be modified and/or have code added before it will achieve an objective.

Copying code from documentation does not require any citation and is permitted on almost all assignments.

However, sometimes identifying which code snippets are considered documentation and which snippets are considered examples can be difficult. To make things harder, documentation often appears on the same website as examples, and sometimes even on the same page.


Coding Documentation

Below are a series of documentation snippets. The snippets include a variety of different languages and sources.


Snippet 1: W3Schools and HTML

W3Schools HTML Images

https://www.w3schools.com/html/html_images.asp

Below is a snippet of code from the W3Schools page displayed above.

W3Schools Snippet HTML Images

https://www.w3schools.com/html/html_images.asp

This code provides documentation on how to use the img tag. This snippet could not be subject to copyright because it is very likely that two programmers would come up with practically the same code. Notice that the snippet has no objective (such as an image slideshow, a hero image banner, or an image zoom tool). These would all be considered example code snippets.

Code from W3Schools is free to use and manipulate. It has been released under the Fair Use License. More information on the terms of use is available on the W3Schools website.


Snippet 2: MDN and JavaScript

MDN JavaScript Functions

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function

Below is a JavaScript code snippet from the Mozilla Developer Network page displayed above. This code provides documentation on how to define a function:

MDN Snippet JavaScript Functions

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function

This snippet could not be copyrighted because it is very likely that two programmers would come up with practically the same code. It is also unlikely that this code could even be used in a project, as the code is simply an empty shell of a function definition that still needs to be given a proper name and additional code to achieve a purpose.

Code from the Mozilla Developer Network website is licensed under the Creative Commons Attribution. More information on the terms of use is available on the Mozilla Developer Network website.


Snippet 3: PHP

PHP Functions

https://www.php.net/manual/en/functions.user-defined.php

Below is a PHP code snippet from php.net. This code provides the syntax for user-defined functions:

PHP Snippet Functions

https://www.php.net/manual/en/functions.user-defined.php

Like the JavaScript snippet, this code is still lacking any purpose. It is an empty shell ready to be copied into a project and customized.

However, on the same website, below the documentation, is a series of user contributed code snippets:

PHP Snippet Mail

https://www.php.net/manual/en/function.mail.php

The above code is a function that can be used to send a UTF-8 formatted email using PHP. Assuming the assignment allows the use of code examples, this code is subject to copyright and must include a citation.

Code from the PHP website is free to use under the Creative Commons Attribution License.


Next Steps

In the next chapter we will review the use of online coding examples and how to incorporate code from these sources into student work.

Previous Chapter - Home - Next Chapter