Code Attribution (College Board AP® Computer Science Principles): Study Guide

Robert Hampton

Written by: Robert Hampton

Reviewed by: James Woodhouse

Updated on

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!

Join the 100,000+ Students that ❤️ Save My Exams

the (exam) results speak for themselves:

Robert Hampton

Author: Robert Hampton

Expertise: Computer Science Content Creator

Rob has over 16 years' experience teaching Computer Science and ICT at KS3 & GCSE levels. Rob has demonstrated strong leadership as Head of Department since 2012 and previously supported teacher development as a Specialist Leader of Education, empowering departments to excel in Computer Science. Beyond his tech expertise, Robert embraces the virtual world as an avid gamer, conquering digital battlefields when he's not coding.

James Woodhouse

Reviewer: James Woodhouse

Expertise: Computer Science & English Subject Lead

James graduated from the University of Sunderland with a degree in ICT and Computing education. He has over 14 years of experience both teaching and leading in Computer Science, specialising in teaching GCSE and A-level. James has held various leadership roles, including Head of Computer Science and coordinator positions for Key Stage 3 and Key Stage 4. James has a keen interest in networking security and technologies aimed at preventing security breaches.