C(++) for the ChatGPT age - teaching undergraduate programming course after three decades of coding
(C) Saina Srivastava, 2023

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:

  1. building chatbots using first-principles from the bottom up can serve as an effective teaching tool. Students built chatbots that can answer questions about diseases (using content from CDC and WebMD/ health/2023) and state representatives (using content from South Carolina’s State Assembly’s website for each member/ politics/ 2022), and in the process also self-discovered Artificial Intelligence (AI) concepts that are normally introduced much later in their degree curriculum.
  2. peer-to-peer code review and testing helps students improve their programming skills. It led to 4-29% improvement on code quality metrics as assessed by students themselves.
  3. while teaching programming, incorporating lessons on computer architecture, compilers, code performance, and AI-based co-development helps students program better.
  4. even when not required, asking students for mid-semester feedback helps in fine-tuning material that students can readily use. Indeed, isn’t that the practical aim of any educational endeavor?

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:

  • Representing, integrating and optimizing answers from CDC and WebMD in Question-Answer pairs for diseases that could be easily maintained
  • Dynamic fetching of content and parsing of HTML
  • Reusing content extraction patterns?across sources and diseases
  • Exploring and using spelling correction algorithms and libraries
  • Learning Swing-based GUI when only a command line was required

?Here, I will like to point out the concepts students self-discovered last year [3] that are still relevant:

  • Handling synonyms of terms, to detect user intents better
  • Performing text processing at the level of letters and not words, to handle noisy user input (text)
  • Handling languages beyond English, like Spanish
  • Discovering new UML diagramming tool
  • Grouping concepts in their representative’s data to answer queries at higher conceptual level, i.e., is-a hierarchy of a knowledge graph
  • Trying multiple programming languages for different project assignments

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/?

要查看或添加评论,请登录

Biplav Srivastava的更多文章

社区洞察

其他会员也浏览了