Code Attribution (College Board AP® Computer Science Principles): Study Guide
Code attribution & credits
What is code attribution?
Code attribution is the practice of acknowledging the original author or origin of code that has been reused or adapted within a program
When developers use code written by someone else (for example, from an open-source library, a tutorial, or a collaborator), they must give appropriate credit to the original source
Attribution is an important part of ethical and responsible collaboration in software development
How to attribute code
Attribution is typically provided as a comment within the code, near the section that was reused or adapted
A complete attribution should include the name of the original author and the source or location where the code was found
Where relevant, any license or usage terms associated with the original code should also be noted
Failing to attribute code correctly can constitute plagiarism, even if the code was freely available online
For example, a correctly attributed procedure might look like this:
// Bubble sort algorithm
// This code was made freely available by example.com
PROCEDURE bubbleSort(list)
{
FOR EACH item IN list
{
// sorting logic here
}
}
Why attribution matters
Attribution gives credit to the people whose work made a project possible
It allows others reviewing the code to find the original source and understand its context
In a professional or academic setting, proper attribution demonstrates integrity and respect for intellectual property
Attributing code for the AP Create Performance Task
For the AP Create Performance Task, reused code must be both acknowledged AND extended with new functionality, adding attribution alone is not sufficient
Use one of the following comment formats depending on the source of the code:
Teacher starter code: This code was provided as starter code by my teacher
API or open-source code: This code was made freely available by [source of code]
Generative AI tools: This code was generated using [Generative AI Tool Name]
Examiner Tips and Tricks
Attribution is required regardless of whether the original code was modified. Using someone else's code without credit is always incorrect, even if it is freely available.
Worked Example
A student copies a sorting algorithm from an open-source library into her Create Performance Task program and includes it with no modifications. What must she do to meet the AP CSP academic integrity requirements?
(A) Add a comment identifying the source of the code
(B) Add a comment identifying the source AND extend the program in some new way by adding new functionality
(C) Rewrite the algorithm in her own words, making attribution unnecessary
(D) Nothing — open-source code can be used freely without acknowledgment
[1]
Answer:
(B) Add a comment identifying the source AND extend the program in some new way by adding new functionality [1 mark]
The CPT requires both acknowledgement and extension of reused code with new functionality; (A) alone is insufficient because unmodified reused code is not student-developed
Unlock more, it's free!
Was this revision note helpful?