论文标题
循环时如何设计
How to Design While Loops
论文作者
论文摘要
初学者发现句法构造被称为一个时循环很难掌握。困难围绕保证循环终止以及学习如何正确测序突变以解决问题。实际上,这两个都是交织在一起的,需要教授学生的模型,以帮助他们推理循环时如何设计。对于已经介绍了如何使用结构递归,生成递归,累积递归和突变来设计程序的学生,教给他们如何在循环时进行设计的任务变得更加容易。例如,这些学生对状态变量,终止论证和累积不变式很熟悉。所有这些都是循环设计的基础。该文章介绍了塞顿·霍尔大学(Seton Hall University)使用的一种新技术,向初学者介绍了循环的设计。它提出了一个设计食谱,学生可以逐步遵循循环驱动程序,循环不变和正确测序突变等内容。本文还提供了一个使用新设计食谱设计基于循环功能的示例。
Beginning students find the syntactic construct known as a while loop difficult to master. The difficulties revolve around guaranteeing loop termination and around learning how to properly sequence mutations to solve a problem. In fact, both of these are intertwined and students need to be taught a model that helps them reason about how to design while loops. For students that have been introduced to how to design programs using structural recursion, generative recursion, accumulative recursion, and mutation, the task of teaching them how to design while loops is made easier. These students are familiar, for example, with state variables, termination arguments, and accumulator invariants. All of these are fundamental in the design of while loops. This articles presents a novel technique used at Seton Hall University to introduce beginners to the design of while loops. It presents a design recipe that students can follow step-by-step to establish such things as the driver of the loop, the loop invariant, and the proper sequencing of mutations. The article also presents an example of designing a while-loop based function using the new design recipe.