# 6.2 Identify and fix errors using a systematic process 使用系统化的流程来识别和修复问题

At any grade level, students should be able to identify and fix errors in programs (debugging) and use strategies to solve problems with computing systems (troubleshooting). Young students could use trial and error to fix simple errors. For example, a student may try reordering the sequence of commands in a program. In a hardware context, students could try to fix a device by resetting it or checking whether it is connected to a network. As students progress, they should become more adept at debugging programs and begin to consider logic errors: cases in which a program works, but not as desired. In this way, students will examine and correct their own thinking. For example, they might step through their program, line by line, to identify a loop that does not terminate as expected. Eventually, older students should progress to using more complex strategies for identifying and fixing errors, such as printing the value of a counter variable while a loop is running to determine how many times the loop runs.

所有阶段的学生都应该能够识别和修复程序错误(调试), 并且使用策略来解决问题(排除故障).

  1. 低阶段的学生能够使用“试错”的方法来修复简单的错误. 比如说, 学生可以重新排列指令顺序来尝试修复错误. 如果面对的是硬件设备无法工作的错误, 学生可以尝试重启设备或者检查该设备是否连接到网络来修复错误.
  2. 随着学生成长, 他们应该更善于调试程序, 并开始考虑程序的逻辑错误 -- 程序能够工作, 但是不符合预期. 通过这种方式, 学生将检查和修正自己的思考. 比如说, 他们通过逐行检查代码, 发现某个循环没有按预期终止(无限循环/死循环)
  3. 最终, 学生应该能够使用更复杂的策略来识别和修复错误, 比如说, 打印计数器变量的值, 来确定循环次数