Skip to content
Marlbridge

AP® Computer Science A · Unit 1 · Topic 1.8

Documentation with Comments: Checklist (Computer Science A 1.8)

A self-check list for Java comments, Javadoc, preconditions and postconditions, linked to the study guide sections and practice questions.

Work through the list without notes. If you cannot do a statement, follow its link, then come back. Guide = study guide; Practice = practice questions.

Understanding

  • I can explain why comments exist and that the compiler ignores them. (Guide: “Code is read far more often than it is written”; Practice Question 1)
  • I can name the three kinds of Java comment and say what each is for. (Guide: “The three kinds of comment”; Practice Question 2)
  • I can define a precondition and say who is responsible for it. (Guide: “Documenting a method”; Practice Questions 4 and 6)
  • I can define a postcondition and say what it describes. (Guide: “Documenting a method”; Practice Question 5)
  • I can explain that a method is not expected to check its preconditions. (Guide: the quotient example; Practice Question 6)

Skills

  • I can predict the output of code that contains commented-out statements. (Guide: the Comments program; Practice Question 3)
  • I can write a precondition and a postcondition for a short method. (Guide: Worked example 1; Practice Question 7)
  • I can tell from documentation alone whether a call respects a precondition and what it returns. (Guide: Worked example 2; Practice Question 8)
  • I can fix a block comment that does not compile. (Practice Question 9)

Reasoning

  • I can explain why a broken precondition removes the guarantee of the postcondition. (Guide: Worked example 2; Practice Question 8)
  • I can explain why block comments do not nest. (Guide: “The three kinds of comment”; Practice Question 9)
  • I can say what makes a comment useful and why a comment that disagrees with the code is dangerous. (Guide: “Writing good comments”)

All ticked? Move on to the Topic 1.9 study guide, Method Signatures, or return to the course roadmap.

AP® and Advanced Placement® are trademarks registered by the College Board, which is not affiliated with, and does not endorse, this website. Marlbridge is an independent tuition provider. It is not an authorized AP course provider, an AP school or an exam centre, and these resources are not official College Board materials. Reading them or doing simulations does not meet the laboratory requirement of an AP science course.