Documentation in AP Computer Science Principles

In AP Computer Science Principles, documentation is written material (comments, readme files, API references) that explains what code does and how to use it. The CED stresses that documentation is necessary for understanding the behaviors a library or API provides and how to call them (Topic 3.14).

Verified for the 2027 AP Computer Science Principles examLast updated June 2026

What is Documentation?

Documentation is any written explanation of software, including code comments, readme files, user guides, and API references. It answers the questions every programmer eventually asks about someone else's code (or their own code from three weeks ago): what does this do, what inputs does it need, and what does it give back?

In the AP CSP CED, documentation shows up in Topic 3.14 (Libraries). A library is a collection of procedures you can reuse, and an API is the specification for how those procedures behave. The essential knowledge is blunt about it: documentation for an API or library is necessary to understand the behaviors it provides and how to use them. Without documentation, a library is a black box you can't safely use. With it, you can plug a procedure into your program knowing exactly what parameters to pass and what to expect in return.

Why Documentation matters in AP Computer Science Principles

Documentation lives in Unit 3 (Algorithms and Programming), Topic 3.14, supporting learning objective AP Comp Sci P 3.14.A, which asks you to select appropriate libraries or existing code segments for new programs. You can't select a library wisely if you can't read what it does, so documentation is the bridge between "this library exists" and "this library solves my problem." It also matters for your own work. When you write a program for the AP performance task or Written Response, documenting it is what makes your code usable by anyone else, including a collaborator, a grader, or future you.

How Documentation connects across the course

Application Program Interface (Unit 3)

An API is the specification for how a library's procedures behave, and documentation is how that specification gets communicated to humans. The API defines the rules; the documentation is where you actually read them.

Commenting (Unit 3)

Comments are documentation written inside the code itself, in plain language the computer ignores. They explain why a tricky line works, while external documentation like a readme explains how the whole program works.

Readme File (Unit 3)

A readme is the front door of a project's documentation. It tells a new user what the program does, how to run it, and what it needs, all before they read a single line of code.

Libraries (Unit 3)

Libraries simplify building complex programs, but only if you know what their procedures do. Documentation is what turns a pile of unfamiliar procedures into tools you can actually use, which is the whole point of Topic 3.14.

Is Documentation on the AP Computer Science Principles exam?

Multiple-choice questions test whether you know documentation's role in using libraries. Expect stems like "What might you find in API documentation?" (procedure names, parameters, return values, expected behavior) or questions about what matters when selecting a library, where good documentation is a legitimate selection factor under 3.14.A. The bigger deal is the Written Response: the 2026 Written Response Q1 asked you to describe one piece of documentation appropriate to include with your program and explain how another programmer could use it to better understand the code. So you need to do two things, name a concrete form of documentation (a comment, a readme, a procedure description) and explain specifically what it helps someone understand, like what a procedure's parameters mean or what the program needs to run.

Documentation vs Commenting

Comments are one type of documentation, not the whole thing. A comment lives inside the source code and explains a specific line or block, while documentation is the broader category that also includes readme files, user manuals, and API references that live outside the code. On the Written Response, "add comments" is a valid answer for documentation, but documentation is not limited to comments.

Key things to remember about Documentation

  • Documentation is written material that explains what code does and how to use it, including comments, readme files, and API references.

  • The CED says documentation for an API or library is necessary for understanding the behaviors it provides and how to use them (Topic 3.14, LO 3.14.A).

  • Good documentation is what lets you select and use a library correctly without reading its internal code.

  • Comments are documentation inside the code; readme files and API references are documentation outside the code.

  • On the Written Response, be ready to name one specific piece of documentation for your program and explain exactly what it helps another programmer understand.

Frequently asked questions about Documentation

What is documentation in AP Computer Science Principles?

Documentation is written material that explains how software works, including code comments, readme files, and API references. In AP CSP it's tied to Topic 3.14, where the CED says documentation is necessary for understanding how to use a library or API.

Is documentation the same thing as comments?

No, comments are just one form of documentation. Documentation also includes readme files, user manuals, and API references that exist outside the code, while comments are explanations written directly inside the source code.

What's the difference between an API and API documentation?

The API is the specification for how a library's procedures behave; the documentation is the written explanation of that specification. You read the documentation to learn what each procedure does, what parameters it takes, and what it returns.

Do I need to write documentation for the AP CSP exam?

Yes, expect to discuss it. The 2026 Written Response Q1 asked for one piece of documentation appropriate for your program and how another programmer could use it to understand the code, so have a concrete answer ready, like a comment explaining a procedure's parameters.

What might you find in API documentation?

Procedure names, what parameters each procedure takes, what values they return, and how the procedures behave. That's exactly the info you need to use a library without seeing its internal code, and it's a common multiple-choice question.