Have students write out test cases and their prediction for what their code will do in class before running it to teach them the practice of analyzing their code first.

  • By making students write down their predictions before running it in class, students will become more thoughtful about how their code will run when they are at home. 
    • If students notice a bug after running their code, make sure that they’ve analyzed what they think went wrong before asking for help debugging.
  • Whenever possible have students write test cases before they write code to get them thinking about what could possibly go wrong and how to avoid it. 
    • Be sure to stress the importance of recognizing edge cases when talking about writing test cases. 

More about this tip

External Source

Interview with Felienne Hermans

Interview with Ellen Spertus