Anti-patterns in Students' Conditional Statements
Producing high-quality code is essential as it makes a codebase more maintainable, reducing the cost and effort associated with a project. However, students learning to program are often given short, automatically graded programming tasks that they do not need to alter or maintain in the future. Thi...
Saved in:
Main Authors | , , |
---|---|
Format | Journal Article |
Language | English |
Published |
10.10.2024
|
Subjects | |
Online Access | Get full text |
Cover
Loading…
Summary: | Producing high-quality code is essential as it makes a codebase more
maintainable, reducing the cost and effort associated with a project. However,
students learning to program are often given short, automatically graded
programming tasks that they do not need to alter or maintain in the future.
This can lead to poor-quality code that, although it may pass the test cases
associated with the problem, contains anti-patterns - commonly occurring but
ineffective or counterproductive programming patterns. This study investigates
anti-patterns relating to conditional statements in code submissions made by
students in an introductory Python course. Our primary motivation is to
understand the prevalence and types of anti-patterns that occur in novice code.
We analyzed 41,032 Python code submissions from 398 first-year students, using
the open-source "qChecker" tool to identify 15 specific anti-patterns related
to conditional statements. Our findings reveal that the most common
anti-patterns are "if/else return bool", "confusing else", and "nested if",
with "if/else return bool" and "confusing else" alone constituting nearly 60%
of the total anti-patterns observed. These anti-patterns were prevalent across
various lab exercises, suggesting a need for targeted educational
interventions. Our main contribution includes a detailed analysis of
anti-patterns in student code, and recommendations for improving coding
practices in computing education contexts. The submissions we analyse were also
collected prior to the emergence of generative AI tools, providing a snapshot
of the issues present in student code before the availability of AI tool
support. |
---|---|
DOI: | 10.48550/arxiv.2410.18989 |