Wanted: Advice from CS teachers
-
@futurebird@sauropods.win I don't know your class or students, and all of this might be stuff you already do or not relevant at all, but here are some things that popped into my mind from my own experiences, in case it's of any use:
- Recent CS education research suggests that functions are one of the hardest intro programming concepts for most students, and shouldn't be introduced till some other concepts are mastered first (search "concept inventories for introductory computer programming"). It can help to first practice associative arrays/hashtables/dictionaries. Modularization into functions is harder still. The fact that many of your students are struggling with creating a function might indicate that they haven't mastered the concept yet and you might do well to back up a bit. If they need some remedial work, I cannot praise Parson's puzzles enough
- When running a lab-style section, where students are actively working on something with your support, I think it helps to interleave lecture time, work time, and debrief time. When you lecture, lecture rules (including controlling when interruptions can happen) apply. Work time is when you let interruptions happen more freely as you walk around to see how folks are doing. When I run such things I tell the students at the beginning of the section what the plan is. After a week or two they get it. I think it's useful to keep each work session on the shorter side, 10-15 minutes, with a well-scoped task and well-defined goal, and then have a debrief afterward where students can describe their experience, vent, brag, what have you. That way they know they'll have opportunities to talk and might be less inclined to shout out randomly
- If you don't have assistants to help you, recruiting other students to help field questions can be very effective. In the past I've had success dividing students into pods of 2 or 3, but only after observing the class for a few weeks. I strategically designed each pod to have at least one student who seemed to be on top of the material and another who seemed to be struggling. This setup requires communicating with the students regularly and adjusting the group assignments throughout the course, but it can lighten the load quite a bit, especially after the students get to know each other. I design classes such that the first few weeks are for setting the stage and warming up, and for me to get to know the students
- I've found it can be helpful to tell students some variation of "I know it's frustrating that your code doesn't work. Even today, code I write doesn't usually work the way I want on the first go. This is an experience you're likely to have the rest of your life when writing code. One thing to take away from this course is how not to be set back by this feeling. It's a normal part of the experience of coding, and it's telling us something". If that lands you can follow up by asking them what they think their frustration/struggle/what have you is telling them. The self reflection can be helpful and you can learn important things about your students this way (it can also lead to awesome discussions). Some students react very positively to hearing that this is a normal part of the process (they think there's something wrong with them, or that they are doing something wrong, if they're feeling frustrated).
I'm kind of shocked that functions are hard. Are they hard for students who understand functions in the context of mathematics?
-
Things to Try:
* look for typos
* look at what the error message indicates.If these don't work consider reverting your last changes to the last working version of your code. Then try making the changes again, but be more careful.
If you can't revert the changes, start removing bits of the code systematically. Remove the things you think might cause the error and run the code again. Isolate the change or code that causes the problem.
You can be a great programmer.
2/2
-
Wanted: Advice from CS teachers
When teaching a group of students new to coding I've noticed that my students who are normally very good about not calling out during class will shout "it's not working!" the moment their code hits an error and fails to run. They want me to fix it right away. This makes for too many interruptions since I'm easy to nerd snipe in this way.
I think I need to let them know that fixing errors that keep the code from running is literally what I'm trying to teach.
Software developer trainer here.
Silly question, but do they read the *entire* error description? And once they solved it do they understand the relationship between the cause, the message, and the fix?
It might be worthwhile to force them to slow down by asking them to write down the entire message on paper.
Try making a game out of it: Who can generate the strangest error message with the fewest amount of “bad” code.
-
My students aren't lazy, but they *can* be a little perfectionist: scared to take risks or sit with not having the answer right away.
They are really upset when their code won't run... but staying calm and *systematically* looking for the cause of the problem, knowing that if you just work through the tree of possible causes you will find it is not something they are good at.
I think I need to teach this.
Maybe I will give them some broken code and we will find the errors together.
When they reach more advanced levels, you will have to teach them to step even farther back, look outside the frame of the monitor, and account for a different layer of the stack.
What if your code works, so well in fact, that it threatens the empires of incumbent elites? What if they break down your door, unperson you, arrest you illegally dozens of times, jail you, brutalize you, deny you legal and medical care, and leave you in pain?
1/n
-
Now I'm curious about whether LLMs' code compiles and executes error-free on their first attempt.
(Aside from the question of whether it meets requirements, as originally intended; always the hard part).
"Now I'm curious about whether LLMs' code compiles and executes error-free on their first attempt."
At first it did not, but they have added a routine to run it through a compiler until it at least runs without syntax errors and probably produces output that seems like what you asked for for a limited example of input.
This is a bolted on extra check, not some improvement in the base LLM.
But some people are acting like it does represent advances in the LLM.
-
Software developer trainer here.
Silly question, but do they read the *entire* error description? And once they solved it do they understand the relationship between the cause, the message, and the fix?
It might be worthwhile to force them to slow down by asking them to write down the entire message on paper.
Try making a game out of it: Who can generate the strangest error message with the fewest amount of “bad” code.
They are middle school kids totally new to programming so reading the whole thing is a challenge and they will encounter too many words they are still learning.
And really their errors are nearly always typos. Or not putting their function call in main body of the program. Or using a variable they have not defined.
So, for them reading deep isn't that important IMO.
The responses can be very verbose and technical.
-
When they reach more advanced levels, you will have to teach them to step even farther back, look outside the frame of the monitor, and account for a different layer of the stack.
What if your code works, so well in fact, that it threatens the empires of incumbent elites? What if they break down your door, unperson you, arrest you illegally dozens of times, jail you, brutalize you, deny you legal and medical care, and leave you in pain?
1/n
How would you regain digital identity, access to your domains, and your money, and get back to doing what you love?
That's what I would like to learn. How to repair a broken body and mind, heal yourself, and go after the systemic injustices that made possible the violence done to a hacker, who could do things the rich and powerful could not? How to fix the system so you won't be bothered on your next coding run, in case your code really works!
It's more fun to compute!


2/2
-
"Now I'm curious about whether LLMs' code compiles and executes error-free on their first attempt."
At first it did not, but they have added a routine to run it through a compiler until it at least runs without syntax errors and probably produces output that seems like what you asked for for a limited example of input.
This is a bolted on extra check, not some improvement in the base LLM.
But some people are acting like it does represent advances in the LLM.
@futurebird @david_chisnall In my (very limited) experience, all that resulted in is pseudocode with
//before each line -
"Now I'm curious about whether LLMs' code compiles and executes error-free on their first attempt."
At first it did not, but they have added a routine to run it through a compiler until it at least runs without syntax errors and probably produces output that seems like what you asked for for a limited example of input.
This is a bolted on extra check, not some improvement in the base LLM.
But some people are acting like it does represent advances in the LLM.
@futurebird @EricLawton @david_chisnall
"I have improved my LLM"
*looks inside*
*improvement is 100% classical handcrafted algorithmic code* -
@futurebird @david_chisnall In my (very limited) experience, all that resulted in is pseudocode with
//before each lineThey've added some new feature that will pull up a little virtual machine and it will let you run the code in there. It also seems to test that the code will at least compile first.
I worry that people seem to think that the LLM just... "evolved" these features when clearly a human person had to add them.
-
"Now I'm curious about whether LLMs' code compiles and executes error-free on their first attempt."
At first it did not, but they have added a routine to run it through a compiler until it at least runs without syntax errors and probably produces output that seems like what you asked for for a limited example of input.
This is a bolted on extra check, not some improvement in the base LLM.
But some people are acting like it does represent advances in the LLM.
@futurebird Software engineering is the stuff around software coding. The AI-vangelists have decided to re-discover the field from scratch, while expressing increasingly hubristic contempt for the lived experience of the entire field.
-
Wanted: Advice from CS teachers
When teaching a group of students new to coding I've noticed that my students who are normally very good about not calling out during class will shout "it's not working!" the moment their code hits an error and fails to run. They want me to fix it right away. This makes for too many interruptions since I'm easy to nerd snipe in this way.
I think I need to let them know that fixing errors that keep the code from running is literally what I'm trying to teach.
@futurebird a couple things I do. (It sounds like you're already doing some of these with slight variation):
1. Tell them I make errors when programming. My former boss who worked for 30 years as a programmer still makes errors.
Errors are not a bad thing. They are part of programming. Part of the process.
Errors are hints. They are clues to figure out how to make the program work. -
Wanted: Advice from CS teachers
When teaching a group of students new to coding I've noticed that my students who are normally very good about not calling out during class will shout "it's not working!" the moment their code hits an error and fails to run. They want me to fix it right away. This makes for too many interruptions since I'm easy to nerd snipe in this way.
I think I need to let them know that fixing errors that keep the code from running is literally what I'm trying to teach.
@futurebird I tell my students that debugging is 50+% of the work, *even* for me with 10+ years of experience. Then I tell them that what makes me a good programmer is not my ability to write error-free code the first time, but my ability to quickly debug code based on oodles of experience.
You could try intentionally making a few common mistakes and showing off the error messages that result if you're projecting an IDE instead of just writing on the whiteboard.
I've also built a Python library called "optimism" that can do "did you use X construct" or even "X inside Y" which helps write certain kinds of practice problems for beginners. It can generate an error message for "you're not using an if statement inside a loop but the problem requires that" for example. Reading other responses here I'm reminded that I should probably put more effort into the error messages...
-
@futurebird a couple things I do. (It sounds like you're already doing some of these with slight variation):
1. Tell them I make errors when programming. My former boss who worked for 30 years as a programmer still makes errors.
Errors are not a bad thing. They are part of programming. Part of the process.
Errors are hints. They are clues to figure out how to make the program work.@futurebird
2. When a student tells me their code doesn't work, I almost never tell them how to fix it. Here are my steps:
a. Did you read the error? Okay then read the error.
b. What does it say? What line is the error on? Do you know what the words mean? Okay let's break it down. *Go word by word through the error to check their understanding and explain the words they don't know*
c. What part of the line do you think is the problem? How can we change it? What else could we put there instead -
Tangentially related:
"AI can write code so why teach how to code?"
"Great point! It can write an essay too, so why teach how to read."
Like. We've had calculators for decades and still teach arithmetic. And functionally the average person needs to know probably more about mathematics and needs to read more than they did a century ago. The same will apply for code.
@futurebird @david_chisnall As a retired coder. The job description hasn’t changed. Just the ratios on tasks performed. Much more reading code vs lots less writing actual lines of code. I like the sound of this debugging approach, as it forces reading and understanding. I have long said the CS courses needed more reading/reviewing code. Like a large part of traditional art courses teach art “criticism”. You have to be able to tell “good” art from “ bad” art to be able to judge if you work is achieving the goals you want from it. The same applies to code.
-
I think they become anxious when their code isn't working the same as what I have up on the projector and they want to get it fixed RIGHT AWAY so they won't fall behind.
Then when one of them starts calling out they all do it.
I may take some time to explain this.
This never happens when I'm teaching math. Something about coding makes them forget some of their manners, and become less self-sufficient. "It's broke! I'm helpless!"
What is that about?
@futurebird
maybe you already do something like this, but I wonder if some sort of preamble to set expectations around errors will help? Something like "computer programming can look like math but the the instant feedback makes it feel very different. Eventually that will feel like a good thing, but know that you may get error messages when you dont expect them and that a large part of learning to code is learning how to read and understand what those error messages are saying." -
@futurebird Software engineering is the stuff around software coding. The AI-vangelists have decided to re-discover the field from scratch, while expressing increasingly hubristic contempt for the lived experience of the entire field.
Having spent thousands of hours working with various involved parties, trying to understand what they did and how IT could help, I came up with Lawton's Law,
> Everybody's job is a lot more complex than you think it is. Including IT folks' jobs. -
@futurebird
2. When a student tells me their code doesn't work, I almost never tell them how to fix it. Here are my steps:
a. Did you read the error? Okay then read the error.
b. What does it say? What line is the error on? Do you know what the words mean? Okay let's break it down. *Go word by word through the error to check their understanding and explain the words they don't know*
c. What part of the line do you think is the problem? How can we change it? What else could we put there instead3. When I ask if anyone has any questions and a student raises their hand I say "individual?" "Okay I'll help you in a minute"
When they blurt out, I say "let me finish and I'll walk around and help people in a minute". So I never help blurt outs immediately so there's no instant gratification encouraging them to blurt out
-
@futurebird I tell my students that debugging is 50+% of the work, *even* for me with 10+ years of experience. Then I tell them that what makes me a good programmer is not my ability to write error-free code the first time, but my ability to quickly debug code based on oodles of experience.
You could try intentionally making a few common mistakes and showing off the error messages that result if you're projecting an IDE instead of just writing on the whiteboard.
I've also built a Python library called "optimism" that can do "did you use X construct" or even "X inside Y" which helps write certain kinds of practice problems for beginners. It can generate an error message for "you're not using an if statement inside a loop but the problem requires that" for example. Reading other responses here I'm reminded that I should probably put more effort into the error messages...
@futurebird with optimism I can find simpler practice problems for low-level concepts like "write a Boolean expression with two operands that evaluates to True" or "write an assignment statement that combines the result from two function calls" and the checker can enforce those things. I think this kind of low-level practice is sometimes missing because it can't be tested by traditional value-based unit tests.
There's a chicken-and-the-egg problem with debugging: if students don't debug, they'll never learn how to really use/understand a topic. But if they don't understand it, debugging is nearly impossible and the chances of making things worse instead of better are high. Debugging seems easy once you've mastered the relevant concepts, but before that error messages often use unintelligible jargon and add with the "root cause is on another line" problem they can be hard to act on.
About a third of the way through my course, we start to emphasize adding prints to see what wrong with your code. My stock answer to every request for help becomes "Did you add a print to learn more? What did it tell you?" I'd bet if you can get students to do that first because you know that's how you'll respond it would help. A quick "okay add a print and I'll look at your code once In done talking" as a blanket response might work?
-
They are middle school kids totally new to programming so reading the whole thing is a challenge and they will encounter too many words they are still learning.
And really their errors are nearly always typos. Or not putting their function call in main body of the program. Or using a variable they have not defined.
So, for them reading deep isn't that important IMO.
The responses can be very verbose and technical.
I like to compare learning to code to learning a foreign language with a native of that language that doesn’t speak my native language. Similar process with similar challenges.
I would recommend starting with collecting the most common errors, simplifying the problem area, and categorizing them. That should help with pattern recognition, give them a vocabulary to describe their issue beyond just “I’m error,” and provide them with a direction in which to search for a solution.
