Teaching programming to liberal arts students: using loop invariants

Loop invariants have long been present in advanced undergraduate and graduate courses on programming methodology or program correctness. Recently there has been an increased interest in using loop invariants in teaching more elementary courses. In this paper, its successful use in teaching elementary programming in a computer literacy course for non-majors is described. The techniques described here, that are necessary in order to work successfully with this population, are also applicable to the teaching of programming to computer science majors.