Use of an Anti-Pattern in CS2: Sequential if Statements with Exclusive Conditions
Use of an Anti-Pattern in CS2: Sequential if Statements with Exclusive Conditions
复制标题
CS2 中反模式的使用:具有独占条件的顺序 if 语句
DOI:
10.1145/3545945.3569744
复制
发表时间:
2023
期刊:
影响因子:
--
通讯作者:
Wiese, Eliane
中科院分区:
文献类型:
--
作者:
Nurollahian, Sara;Hooper, Matthew;Salazar, Adriana;Wiese, Eliane
How can we teach students to use more readable code structures? How common is it for students to choose less readable (but still functional) alternatives? We explore these questions for a specific anti-pattern: using sequential if statements when conditions are exclusive (rather than using else-if or else). We created and validated an automated detector to identify this anti-pattern in student's code. Running the detector on 1,764 homework submissions (from 270 students in a CS2 class on data structures and algorithms) showed that this anti-pattern was common and varied by assignment: across 12 assignments, 3% to 50% of submissions used sequential ifs for exclusive cases. However, using this anti-pattern did not preclude using else-ifs: across assignments, up to 34% of the submissions used both forms. Further, students used sequential if statements in surprising ways, such as checking a condition and then the negation of that condition, indicating a more novice level of understanding than expected for an intermediate course. Hand-inspection of the detector-flagged cases suggests that sequential ifs for exclusive cases may be a code smell that can indicate larger problems with logic and abstraction.
登录
查看更多内容
DOI:
--
发表时间:
2011
期刊:
IFAC Symposium on Advances in Control Education
影响因子:
--
作者:
Jacqueline L. Whalley;T. Clear;Phil Robbins;Errol Thompson
通讯作者:
Errol Thompson
影响因子:
7.4
作者:
E. Soloway;Kate Ehrlich
通讯作者:
E. Soloway;Kate Ehrlich
DOI:
--
发表时间:
2011
期刊:
影响因子:
--
作者:
Yakov Fain
通讯作者:
Yakov Fain
DOI:
--
发表时间:
2019
期刊:
Annual Conference on Innovation and Technology in Computer Science Education
影响因子:
--
作者:
H. Keuning;B. Heeren;J. Jeuring
通讯作者:
J. Jeuring
DOI:
--
发表时间:
2022
期刊:
IEEE Global Engineering Education Conference
影响因子:
--
作者:
Oscar Karnalim;Simon;W. Chivers
通讯作者:
W. Chivers