Use of an Anti-Pattern in CS2: Sequential if Statements with Exclusive ConditionsOnline
How can we teach students to use code structures that support readability? How common is it for students to choose less readable (but still functional) alternatives? We explore these questions for a specific novice structure choice: 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 code. Running the detector on 1,764 homework submissions (from 267 students in an intermediate CS class on data structures and algorithms)showed that this pattern was common and varied by assignment, with 3% to 50% of submissions using this pattern across 12 assignments. However, the use of the sequential if anti-pattern did not preclude the use of else-if: up to 34% of submissions used both forms across assignments. 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.
Thu 16 MarDisplayed time zone: Eastern Time (US & Canada) change
15:45 - 17:00 | Online Authors' Corner 2Papers at Online Authors' Corner Opportunity for attendees to connect with authors for interactive Q&A and discussion | ||
15:45 75mPaper | Evolving a Programming CS2 Course: A Decade-Long Experience ReportOnlineGlobal Papers Nasser Giacaman The University of Auckland, Partha Roop University of Auckland, Valerio Terragni University of Auckland DOI | ||
15:45 75mPaper | Case Study: Mapping an E-Voting Based Curriculum to CSEC2017Online Papers Muwei Zheng University of California, Davis, Nathan Swearingen Indiana University–Purdue University Indianapolis, Steven Mills Indiana University–Purdue University Indianapolis, Croix Gyurek Indiana University–Purdue University Indianapolis, Matt Bishop The University of California, Davis, Xukai Zou Indiana University–Purdue University Indianapolis DOI | ||
15:45 75mPaper | Teaching Site Reliability Engineering as a Computer Science ElectiveOnline Papers DOI | ||
15:45 75mPaper | Towards a Validated Self-Efficacy Scale for Data ManagementOnline Papers Wensheng Wu University of Southern California DOI | ||
15:45 75mPaper | A Summer Camp Experience to Engage Middle School Learners in AI through Conversational App DevelopmentK12In-Person Papers Gloria Ashiya Katuka University of Florida, Yvonika Auguste University of Florida, Yukyeong Song University of Florida, Xiaoyi Tian University of Florida, Amit Kumar University of Florida, Mehmet Celepkolu University of Florida, Kristy Elizabeth Boyer University of Florida, Joanne Barrett University of Florida, Maya Israel University of Florida, Tom McKlin The Findings Group DOI | ||
15:45 75mPaper | Attracting Adults to Computer Programming via Hip HopOnline Papers Douglas Lusa Krug Virginia Commonwealth University, Chrystalla Mouza University of Illinois, Urbana-Champaign, W. Monty Jones Virginia Commonwealth University, Taylor Barnett Virginia Commonwealth University, David C. Shepherd Virginia Commonwealth University DOI | ||
15:45 75mPaper | Assessing Peer Correction of SQL and NoSQL QueriesOnline Papers Wensheng Wu University of Southern California DOI | ||
15:45 75mPaper | Use of an Anti-Pattern in CS2: Sequential if Statements with Exclusive ConditionsOnline Papers Sara Nurollahian University of Utah, Matthew Hooper University of Utah, Adriana Salazar University of Utah, Eliane Wiese University of Utah DOI |