C(++) for the ChatGPT age - teaching undergraduate programming course after three decades of coding
In this article, I am sharing my experience of teaching advanced programming techniques at? the undergraduate level twice (Spring 2023 [1] and 2022 [2]) using my experience of coding in C/C++, Java, and Python for over three decades in industry. Among the innovations I introduced, students did a series of programming assignments in their preferred computer language that would lead to the creation of a collaborative assistant (or “chatbot” in popular parlance), peer reviewing of homework, and focus on code reuse. I will summarize the takeaways, and then elaborate.?
The lessons I want to share are:
Now the details.
Last Spring (2022), I taught an undergraduate course on advanced programming techniques for the first time since graduating with my own undergraduate degree in 1993, and found that to be an amazing learning experience [2,3]. I again taught it in Spring 2023 but to a smaller, Honors section, where students meet a higher academic preparedness requirement. Programming is the mainstay skill of any computer science student just like drawing blueprints is the core skill of any (building) architecture student. As a result, it has to be taught with special responsibility so that valuable insights stay for their professional careers. Like learning human languages, learning computer languages is a life-long activity but it gets progressively hard to learn new languages over time [4]. The course had traditionally focused on C++ language and its closely related C, and taught concepts like object-oriented programming, memory management, and input output processing. New in 2023, I wanted to factor in the fact that research has shown that programming is a social process as more time is spent in understanding and reusing others’ code rather than writing new ones [5]. Furthermore, in Spring 2023, conversations about ChatGPT abounded in society, and this phenomenon had to be addressed in the class as well [6].?
It is relevant to describe my own programming journey here so that my challenges and joy of teaching can be contextualized. I had started learning C/C++ in 1989 when I started my undergraduate study and used them all the way to my PhD work in Artificial Intelligence (AI) sub-field of planning, and the first major industry job. During my PhD, I also played with Lisp and Prolog. Around 1997, the Java language started gaining prominence and I began learning and playing with it, but I used it in serious applications from 2001 to 2018 while at IBM. Around 2016, I started moving to the Python language. Nowadays, most programming I do is in Python, but get to see Java and C++ code sometimes.??
I continued with my teaching philosophy from last year [3] - of teaching students about techniques that will transcend any single computer language and yet, be consistent with other/ future sections of the course; impart the value of code reuse and sharing, peer review, and documentation. Finally, I wanted students to build useful code in a new domain - health - and also introduce them to AI and put it in context with ChatGPT. We had C++ as the main language for instruction, but I also gave examples in Java and Python when feasible. We had homework (HWs) only in C++ but they were peer-reviewed in class itself. Students also had to do six programming assignments (PAs) in any of the object-oriented languages: C++, Java or Python, and assemble them to complete a course project. The course project was to build a chatbot, i.e., a text-based collaborative assistant, that a user could use to know about a disease they could choose. For information about the disease, they could use information from the websites of Center for Disease Control (CDC), the government agency in the US for public health, and WebMD, an extensive and respected online source.?We also had paper-pen based exams (quizzes) so that understanding of concepts are tested. Coding had to be done using Github.
?As the course progressed, I made small changes. Midway through the course, I asked the students any new topic they would like to learn. I was pleasantly surprised when they asked to know more about multi-threaded programming, a concept that needed understanding of computer architecture. As we discussed PAs, I found talking about similar capability in ChatGPT to be quite useful. For example, when a chatbot shows the source of answer content, this provenance information helps build user trust but ChatGPT does not provide it. Further, I offered the students a choice for the last PA where they had to assemble the whole chatbot. They could either build individual chatbots that could answer questions for one disease (getting extra credits if they used code by anyone), or build a single common chatbot that could answer for a wide variety of diseases, assessing and reusing the best implemented ideas and code among themselves. The students chose to build the common chatbot! This required more effort on their parts looking at code across languages, but led to a better designed and tested chatbot and increased within-class engagement.?
The approach continued to produce good results that were seen last year [3]. The peer-evaluation of HW code and testing lead to improvement in quality of class code over the semester. It improved by 4-15% on the measured scale, but was smaller than up to 29% achieved in 2022*. A possible explanation for this is that the students of 2023 Honors class may already be having good programming skills to begin with. The students also self-discovered relevant concepts that were not specifically taught:
?Here, I will like to point out the concepts students self-discovered last year [3] that are still relevant:
领英推荐
In summary, the semester needed additional work from both students and myself. I am thankful that overall, students took extra efforts, and found the lectures valuable as reflected in the class performance as well as feedback. I am also thankful to colleagues who have taught other sections and have shared their experience and course material, and helped avoid pitfalls. I hope this experience is useful to others teaching programming to undergraduates to tackle challenging problems of the future.?
Biplav is a Professor of Computer Science specializing in AI at the AI Institute, University of South Carolina, which he joined after two decades at IBM. Above is a personal opinion.
* there are some caveats: (a) the students evaluated themselves although we gave the rubric on how to score, (b) the HWs were also on different topics, (c) the number of students participating in each quiz were not constant.?
Reference:
[1] Advanced programming techniques (Spring 2023) – https://sites.google.com/site/biplavsrivastava/teaching/csce-240-advanced-programming-techniques; https://github.com/biplav-s/course-adv-proglang-s23/
[2] Advanced programming techniques (Spring 2022) – https://sites.google.com/site/biplavsrivastava/teaching/csce-240-advanced-programming-techniques/csce-240-spring-2022-advanced-programming-techniques; https://github.com/biplav-s/course-adv-proglang/?
[3] Blog about teaching Advanced programming techniques (Spring 2022), https://www.dhirubhai.net/pulse/back-c-teaching-undergraduate-programming-course-after-srivastava/?
[4] Here We Go Again: Why Is It Difficult for Developers to Learn Another Programming Language? by Nischal Shrestha, Colton Botta, Titus Barik, Chris Parnin, Communications of the ACM, March 2022, Vol. 65 No. 3, Pages 91-99, 10.1145/3511062, https://cacm.acm.org/magazines/2022/3/258915-here-we-go-again/fulltext?
[5] From Code Complexity Metrics to Program Comprehension, Dror G. Feitelson Communications of the ACM, May 2023, Vol. 66 No. 5, Pages 52-61, https://cacm.acm.org/magazines/2023/5/272293-from-code-complexity-metrics-to-program-comprehension/fulltext?
[6] Working with ChatGPT-like LLM-based-AIs Reliably: Don’t Look at Only the Technology Pillar For All The Answers, Biplav Srivastava, Jan 2023, https://www.dhirubhai.net/pulse/working-chatgpt-like-llm-based-ais-reliably-dont-look-srivastava/?