DeepAI

# How to Design While Loops

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.

05/27/2019

### Proving Non-Termination via Loop Acceleration

We present the first approach to prove non-termination of integer progra...
08/21/2020

### Using Video Game Development to Motivate Program Design and Algebra Among Inner-City High School Students

Introducing inner-city high school students to program design presents u...
11/21/2019

### NaMemo: Enhancing Lecturers' Interpersonal Competence of Remembering Students' Names

Addressing students by their names helps a teacher to start building rap...
03/05/2021

### MORA – Automatic Generation of Moment-Based Invariants

We introduce MORA, an automated tool for generating invariants of probab...
06/27/2019

### FSM Error Messages

Computer Science students, in general, find Automata Theory difficult an...
05/08/2021

### All Together Now: Teachers as Research Partners in the Design of Search Technology for the Classroom

In the classroom environment, search tools are the means for students to...
09/02/2021

### A Reasoning Engine for the Gamification of Loop-Invariant Discovery

We describe the design and implementation of a reasoning engine that fac...