{"title":"How to make while loops iterative: an introduction for first-year CS students","authors":"M. Morazán","doi":"10.1145/3442481.3442504","DOIUrl":null,"url":null,"abstract":"The design of while loops is among the hardest lessons for beginners in programming. Their design is difficult because students must do more than solve a problem. They must also, for example, correctly sequence mutations, define loop invariants, and avoid infinite loops. Another difficulty students face is making while loops iterative. This issue is commonly ignored in programming textbooks for beginners despite being relevant to future courses such as Computer Architecture, Programming Languages, and Algorithms. The difficulty with making while loops iterative revolves around the elimination of delayed operations. This requires introducing beginners to the concept of control. This article presents a novel transformation recipe for beginners to make while loops iterative. The transformation recipe guides students on how to accumulate control information on a stack to eliminate delayed operations in the body of loops. In addition, this article presents descriptive statistics obtained from students on the maiden voyage of the new design recipe. The empirical data suggests that students feel that writing iterative while loops is hard, but enlightening. In addition, the empirical data suggests that students have a very favorable opinion about designing while loops.","PeriodicalId":262503,"journal":{"name":"Proceedings of the 9th Computer Science Education Research Conference","volume":"86 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2020-10-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 9th Computer Science Education Research Conference","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3442481.3442504","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
The design of while loops is among the hardest lessons for beginners in programming. Their design is difficult because students must do more than solve a problem. They must also, for example, correctly sequence mutations, define loop invariants, and avoid infinite loops. Another difficulty students face is making while loops iterative. This issue is commonly ignored in programming textbooks for beginners despite being relevant to future courses such as Computer Architecture, Programming Languages, and Algorithms. The difficulty with making while loops iterative revolves around the elimination of delayed operations. This requires introducing beginners to the concept of control. This article presents a novel transformation recipe for beginners to make while loops iterative. The transformation recipe guides students on how to accumulate control information on a stack to eliminate delayed operations in the body of loops. In addition, this article presents descriptive statistics obtained from students on the maiden voyage of the new design recipe. The empirical data suggests that students feel that writing iterative while loops is hard, but enlightening. In addition, the empirical data suggests that students have a very favorable opinion about designing while loops.