Have pair programming groups rotate computers every 10 minutes in an activity where they have to continue to solve the assigned problem using other pairs’ code to motivate writing good comments.

  • Students must dissect the meaning of other students’ code and comments in order to continue working on the problem.
    • Unclear variable names and a lack of good comments can make code difficult for students to understand, even when they’re working on the same problem.
  • Students may have trouble knowing what information they should include in comments.
    • Having to figure out what other pairs’ code is doing helps students learn what comments are necessary for other people to understand their own code.
  • Make sure the programming assignment is easy enough that students can make progress during each rotation but difficult enough that it’s hard to understand the code without clear comments.
  • To learn more about a similar programming activity, check out our tip on rotary programming.

More about this tip

External Source
Interview with Elisa Cundiff