Abstract | ||
---|---|---|
Iteration is one of the basic programming constructs taught in a CS1 course. Students learn to use loops by being exposed to a range of loop examples, initially with scalar values and then over composite data such as vectors. When writing a finite loop to iterate over a vector, we can iterate upwards or downwards. In many cases, the order does not change the outcome; however, for some tasks it is important to consider which direction is most suitable before writing a solution. For example, if we want to shift the elements of a vector one position to the right (left), we should choose a downward (upward) loop. However, when we asked undergraduate students to implement the shift right task, most of them used an upward loop. This outcome indicates the students didn't consider the loop direction before coding the iterative task. We hypothesise that this was in part due to course materials favouring upward loops. To confirm this hypothesis, we have analysed the examples presented in our local CS0/CS1 courses as well as four popular MOOCs. This analysis has corroborated an overwhelming bias towards upward loops. We have also found a lack of instruction regarding the possible impact of direction on code efficiency. Thus, in order to improve novice programmers' iteration skills, we propose CS1 examples that expose students to a more balanced mix of up/down loops and the explicit choice of direction.
|
Year | DOI | Venue |
---|---|---|
2020 | 10.1145/3287324.3287350 | Proceedings of the 50th ACM Technical Symposium on Computer Science Education |
Keywords | Field | DocType |
down loops, iteration, novice programmers, program design | Programming constructs,Programmer,Computer science,Scalar (physics),Arithmetic,Logical shift,Coding (social sciences),Program Design Language,Multimedia,Course materials | Conference |
ISBN | Citations | PageRank |
978-1-4503-5890-3 | 0 | 0.34 |
References | Authors | |
9 | 3 |
Name | Order | Citations | PageRank |
---|---|---|---|
Cruz Izu | 1 | 149 | 23.41 |
Cheryl Pope | 2 | 8 | 1.59 |
Amali Weerasinghe | 3 | 90 | 15.41 |