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
quotientexample; Practice Question 6)
Skills
- I can predict the output of code that contains commented-out statements. (Guide: the
Commentsprogram; 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.