class: center, middle, inverse, title-slide # Teaching Debugging to Learners ## May Instructor Development Meeting ###
Maria Kamenetsky
(she/hers)
###
PhD Candidate, Epidemiology
University of Wisconsin-Madison
### May 13th, 2021 --- # Overview - Introductions - What is Debugging? - Previous Research - Basic Principles - Discussion - References --- # What is Debugging? [Debugging](https://en.wikipedia.org/wiki/Debugging) is "the process of finding and resolving bugs (defects or problems that prevent correct operation) within computer programs, software, or systems." "**Systematic** trouble-shooting". --- # Previous Research While many learners intuit debugging techniques, few use systematic approaches such as hypothesis generation and testing (Whalley 2021). - Perscheid et al. found that in a study of professional developers, none of the participants in the study were trained in debugging. - Lahtinen et al. found that novices reported that finding bugs was one of the most difficult issues when learning to program. - Ko et al. found proposed that teaching explicit strategies for debugging may help students develop better programming skills. --- # Previous Research Whalley et al. 2021: - A study of university students in an introductory Python class, which incorporated 1 lab session (out of 20) that focused on debugging. Following exercises with bugs in them, students had to answer several questions including: - 1) To **describe** the differences between expected and observed output and what input data was related to the problem as well as which part of the algorithm was working incorrectly. - 2) To **describe** what additional information they would need to find the bug. - 3) To **identify** which lines of code the bug was likely in. - 4) To **explain** how to fix the bug. --- # Previous Research Several approaches were considered: - A) **Static code comprehension**: Reading the code. - B) **Dynamic code comprehension**: Using print statements. - C) **Bug Location**: Reducing the search space by limiting the debugging to a smaller section of code. - D) **Information Gathering**: Guessing about bug causes while seeking additional information. (Murphy et al. (2008) also recommend teaching **tracing** a loop on paper, especially if tracking multiple variables as well as use of debuggers.) Many students indicated they preferred *not* to use a formal process and just to "debug their own way". *The students who reflected on debugging being inefficient did not use any of the strategies described above* --- # Previous Research What Worked? - 1) Reflection - Can be facilitated by group sharing or pair debugging or to incorporate guiding questions. - 2) Step-wise process - Emphasizing the step-wise process can break down debugging into manageable tasks, especially if the code is more complex. Michaeli & Romeike (2019) found empirical evidence of formal teaching of debugging on students self-efficacy and debugging performance. --- # Examples of Structured Approaches .center[![Initial output](diagram1.png)] --- # Examples of Structured Approaches .center[![Initial output](diagram2.png)] --- # Examples of Structured Approaches .center[![Initial output](diagram3.png)] --- # Research Questions Debugging is often not formally taught, even in formal computer sciences courses. Many learners pick up techniques along their career or intuitively learn these principles on their own. 1. **What are the principles of debugging that are explicitly teachable to learners?** 2. **Would it be possible to incorporate some principles of debugging in teaching?** --- # Basic Principles A) Skills 1. Self-Efficacy 2. Google-ing 3. Print Statements 4. Control Flow/Logic-ing Things Out B) Tools 1. How to use the help 2. Using debugging tools --- # Basic Principles A) Skills 1. Self-Efficacy 2. Google-ing 3. **Print Statements** 4. Control Flow/Logic-ing Things Out B) Tools 1. How to use the help 2. **Using debugging tools** These could be separate sections in a workshop. --- # Print Statements and Debuggers **Print Statements** When a bug cannot be identified from reading the code (static code comprehension), using print statements can be a useful debugging strategy. Print statements, however, should be meaningful and strategically placed. **Debuggers** Many debuggers exist that can help find the bug location. Possibly an extension that could be briefly demonstrated? --- # Basic Principles A) Skills 1. Self-Efficacy 2. **Google-ing** 3. Print Statements 4. **Control Flow/Logic-ing Things Out** B) Tools 1. How to use the help 2. Using debugging tools These could be stealthily incorporated into existing workshops. --- # Google-ing and Control Flow **Google-ing** Google-ing is an art. However, identifying the key parts of a buggy problem and what to Google search can be demonstrated. Additionally, how to Google error messages. **Control Flow** Can be equivalent to the *tracing* strategy mentioned by Murphy et al. (2008). Can be demonstrated by writing the expected input/output of different functions. As an example, demonstrate writing things out (ex: in `dplyr` of `ggplot2` sequences) using a systematic approach. --- # Basic Principles A) Skills 1. **Self-Efficacy** 2. Google-ing 3. Print Statements 4. Control Flow/Logic-ing Things Out B) Tools 1. How to use the help 2. Using debugging tools How can we help learners develop self-efficacy in workshops? --- # Self-Efficacy What we already do: - Scaffolding - Carefully curated challenges But... - Pressure of "correct" answer - Stereotype threat - Time pressure and peer pressure Could we... - Create a workshop-specific systematic approach/step-wise process to debugging that we incorporate in when setting up challenges? <!-- - Take the "right" answer out if it --> <!-- - Open-ended challenge --> <!-- - Ex: Recreate a plot we make on the board by hand? --> - Have learners keep track of the links they used and take time to reflect on their own debugging? --- # Discussion - What are other "principles of debugging"? - What do you think we do already in our workshops? - What do you think could be incorporated into the workshops and how? --- class: center, middle # Thank you! mkamenetsky@wisc.edu @mkamenets https://mariakamenetsky.com/ --- # References - Jacqueline Whalley, Amber Settle, Andrew Luxton-Reilly. 2021. Novice Reflections on Debugging. *SIGCSE Bull.* 2021. - Michael Perscheid, Benjamin Siegmund, Marcel Taeumel, and Robert Hirschfeld. 2017. Studying the advancement in debugging practice of professional software developers. *Software Qual. J.* 25 (2017), 83-110. - Essi Lahtinen, Kirsti Ala-Mutka, and Hannu-Matti Jarvinen. 2005. A Study of the Difficulties of Novice Programmers. In *Proceedings of the 10th Annual SIGCSE COnference on Innovation and Technology in Computer Science Education* (Caparica, Portugal)(ITiCSE '05). Association for Computing Machinery. New York, NW, USA, 14-18. - Amy Ko, Thomas D. LaToza, Stephen Hull, Ellen A. Ko, William Kwok, Jane Quichocho, Harsitha Akkaraju, and Rishin Pandit. 2019. Teaching Explicit Programming Strategies to Adolescents. In *Proceedings of the 50th ACM Technical Symposium on Computer Science Education* (Minneapolis, MN, USA)(*SIGCSE'19*). Association for Computing Machinery, New York, NY, USA, 469-475. - Tilman Michaeli and Ralf Romeike. 2019. Improving Debugging SKills in the Classroom - The Effects of Teaching a Systematic Debugging Process. In *Proceedings of the 14th Workshop in Primary and Secondary Computing Education* (Glasgow, Scotland)(WiPSCE'19). - Laurie Murphy, Gary Lewandowski, Renee McCauley, Beth Simon, Lynda Thomas, Carol Zander. 2008. Debugging: The Good, the Bad, and the Quirky - a Qualitative Analysis of Novices' Strategies. *SIGCSE'08*(Portland, Oregon, USA).