I've taught programming for years and my students always understand lectures but freeze when coding alone what am I doing wrong?
Posted by More-Station-6365@reddit | learnprogramming | View on Reddit | 28 comments
Hey r/learningprogramming, posting here because I want honest feedback from people who are actually learning or have recently learned programming. I've been teaching an introductory programming course at a US college for a few years now. And every single semester without fail I see the exact same pattern in the majority of my students. They follow my lectures perfectly. They answer questions correctly in class. They can read code and explain what it does. But the moment I give them a blank editor and say "now write this yourself" — they freeze completely. It doesn't matter how simple the task is. Even students who seemed confident during the lecture suddenly don't know where to begin when there's no example in front of them. The specific patterns I keep noticing are: Students understand a concept while watching but can't reproduce it 10 minutes later without reference material. They know the syntax but don't know how to break a problem down into steps before writing code. They treat every new problem like they've never coded before even when it uses concepts they've already learned. They get stuck on errors and immediately ask for help instead of trying to read and understand the error message first. I've tried different teaching approaches — more examples, fewer examples, more practice time, pair programming — but this gap between understanding and independent writing keeps showing up. My honest question to this community is — if you've been through this struggle yourself, what finally helped you bridge that gap? Was it something a teacher did differently, a practice method that worked, or just time and repetition? I'm genuinely trying to improve how I teach this and I feel like the people learning it have more insight than most teaching guides do.
buzzon@reddit
Build a ladder:
Instructor does, students watch
Instructor does, students help
Students do, instructor helps
Students do
SourceScope@reddit
In my classes when the instructor does, he would still ask the class constantly. Of course we didnt always had an answer. Then he would explain what he did and why
Never did step 1
ZestycloseSample7403@reddit
This is actually genius
BigBad0@reddit
This is great advice. Most people have this problem, it is normal to WRITE hello world first. Respect the baby steps.
Responsible-Rock-680@reddit
Reading code and writing code are different muscles. Give them more blank-page reps where the goal is a bad first draft they can fix, not a perfect answer.
Sea-Attorney2788@reddit
tell them they are bad at programming
Fit-Ad9820@reddit
Lol, and AI is not going to help at all XD
Your brain learns what it needs. You either learn through fear or through necessity.
Why would kids bother learning something if AI can already do it better?
Would you make a burger from scratch and spend at least 20 dollars, or would you just go to McDonald’s and get a delicious McCheese for 5 dollars?
Would you cut down a big tree with an axe for two hours, or would you use a chainsaw and finish it in 30 minutes?
Would you demolish an old house by hand, spend more than 900 hours, and almost a million on people, tools, and labor, or would you just use an excavator and destroy the whole house in two days, including cleanup?
In Peru, 26 years ago, we learned to code by hand, without computers, using only paper and pencil. We had to follow every step, draw the logic flowcharts, and sketch the sequences.
Even our programming exams were done on paper, just like calculus or physics.
Good luck, professor. Don’t worry too much.
OjinAI@reddit
they can recognize code but they havent practiced generating it. recognition vs generation is a real cognitive gap, bigger than most teachers expect. the fix is tons of very small generative exercises where they have to make a single tiny decision. not "write a function," but "write the next line" type stuff. it stacks faster than you'd think.
peterlinddk@reddit
It sounds a lot like you are teaching theory and conceptual models - and while they can be excellent for understanding what is going on, it is of absolutely no help when having to do the work for the first time.
Imagine that you were in a class being taught how a 4-stroke petrol-engine worked - you get all the examples of the valves, the intake, the exhaust, the spark-plugs, the cam-shaft and so on. Illustrated with lots of cool animated drawings of what happens inside the engine when it runs. The teacher is excellent, and you feel that you truly understand everything. Next you are going to the shop-floor, where there's a row of cars with the engine exposed - can you replace the piston-rings on one of those engines?
Or take language, you can learn about sentence structure, grammatical rules, spelling, word-classes: verbs, nouns, adjectives, etc, but does that mean that you can have a conversation with someone speaking that language (other than asking for directions to the library)?
Think of how young children learn to speak, without ever being taught the theory of grammar - but still somehow master it in a fairly short time. And then those same children grow up and struggle with learning the grammar that they have been using for most of their lives ...
They learn by doing - try things, fail a lot, and get corrected slightly to constantly improve - and sometime later they learn the theory that explains the hows and whys of what they are already doing.
The difference is in deductive and inductive instruction - what you are doing sounds mostly like the "deductive" way, where the students are being explained everything (often in a very generalized way), and then they have to deduce that "knowledge" into their doing (almost always in a very specialized way for that specific assignment). But with inductive instruction the teacher gives examples and activities that demonstrate some aspects of the learning - and after having completed them, the students are (or shold be) able to induce the general rules and principles of what they have just done. Or the teacher can explain the theory after they have tried it out in practice.
I have had great succes with a very-very short introduction to the what and why for todays lesson, and then a not so short tutorial, where the students follow step-by-step instructions to simply try it out for themselves.
Followed by a less detailed tutorial, where they have to remember (or at least redo) what they did the first time - but this time I force them to make mistakes, and cause errors, to get used to seeing errormessages and fix things.
Then an assignment, where they have to apply the same learning, but with variations, e.g. different data-types, or going in the other direction, or something. And finally some project-work, where they have set their own constraints and goals, and have to figure out how to apply that day's lesson.
The next lesson then goes deeper into the theory, with a lot of quizzes and experiments for them to do along with the slides, so it isn't just their teacher showing magic-tricks on stage :)
It worked great before we got AI, and students realized that they could just feed the final project into the AI, and get a solution, so they didn't have to show up for class the next couple of weeks ...
KandevDev@reddit
the gap you are describing is the difference between "understanding the demonstration" and "having the operational skill". those are different skills entirely. lectures train pattern recognition ("oh i have seen something like this"). solo coding requires generation ("i must produce something from a blank page"). people do not graduate from one to the other automatically, they need explicit forced practice with the second.
what worked in courses i have TA-d: live "from blank file to working solution" sessions where you start with an empty editor on the projector and let students call out next steps. it makes the generation process visible. then assignments need to be solo, no copy-paste from lecture, no LLM use, write the first solution then iterate. they will hate it for the first three weeks and then suddenly start producing.
Dazzling_Music_2411@reddit
There's a school of thought that advocates NOT teaching in class!
Give the students the "homework" to read the lecture themselves, do not deliver it to them.
Then, the next day in class, practice the examples. Yes, IOW, completely reverse the roles of class and homework.
I think there is a lot to be said for this approach.
desrtfx@reddit
This was the approach our "C" course teacher took as they themselves were learning C along with us. They even completely reversed the teacher/student roles where we would become the teachers and the teacher became the student.
Honestly, albeit being very strange at the beginning, it really worked far, far better than expected. We learnt much more that way than with conventional front teaching. We even got to the point where we became eager to prepare our lessons in the best possible manner. It became actual fun.
Dazzling_Music_2411@reddit
Very wise.
Would you care to tell where this little marvel took place? I love hearing about little success stories like that!
desrtfx@reddit
This was way back at the end of the 1980s in Graz, Austria, Europe. The age group was >18 years (our oldest classmate - not teacher - was 42 at that time) - it was in a technical college.
The teacher was quite close to retirement age at that time. I still admire him for his stance and approach in that manner and have tried to incorporate his approach when teaching my students as well.
Problem with that approach is that you need engaged and willing students. If the students are not engaged you have no chance. You can't even really turn them around. It also only works in cultures that lean on understanding instead of on memorization (have been teaching in such cultures as well).
Dazzling_Music_2411@reddit
Gotta love Austria sometimes.
That applies to all education. Just some people haven't realised it yet, and think you can force it through 😭
healeyd@reddit
Leaving aside all the "kids these days" or "AI brain-rot" finger-pointing, I do wonder if the way that computers are geared these days makes people more scared to dive in. So many moving parts - passwords, accounts, installations, downloads, patches, dependencies etc. When I was a kid you'd just turn the bloody thing on and load your file!
HardlyAnyGravitas@reddit
How exactly do you do this. If I was put in front of a blank editor, with no other code and no reference materials I would probably forget the format of a print statement, despite being able to write complex code in the right environment.
You even see it in online tutorials - somebody who is clearly an expert in the language makes simple mistakes while writing code 'on the fly' and has to correct their errors as they go.
You don't code in a vacuum, and it's unrealistic to expect students to be able to do it.
aqua_regis@reddit
This is just another version of the classic theory and passive understanding versus active doing problem.
Think about it that way: you can read and understand a novel quite easily, but could you write a comprehensive, meaningful, fully developed one?
Reading, understanding and writing are two completely different skills that need to be individually trained.
Also, lectures give passive understanding, which is basically "false understanding". The brain only thinks that it understands, while real understanding can only be acquired through ample practice.
In other words: you can watch all the matches of top tennis players, analyze their every move, stance, gesture, etc. yet, you won't magically become able to actually play tennis without going to the court and struggling and fighting.
Spare_Dependent6893@reddit
Do an exercise with them
Then they redo the same exercise with a little change
Then they continue another with same approach
Then you give them the lecture as homework
Next day they start by exercices based on the lecture to complement to have the solution
And new exercises for next lecture
True_World708@reddit
It's because they don't have enough practice
unk214@reddit
This reminds me so much of my first programming class in college. I already knew how to code so the class was easy, a few students asked me for help so I tutored them. A few of them made progress but others were simply stuck.
I would go over the problem talk about the topic then talk about approaches for the solution.
Dead ass they would say right afterwards “OK but teach me how to solve it myself….:” even though I literally just did.
My suggestion is to remind them this is a new topic and new way of thinking. This is very similar to learning math for the FIRST time. As such do allocate time to it and do memorize some techniques. Eventually they start to come together. BUT if you treat programming for the first time like an English class you’ll never get it.
With a few of them I gave up and just told them step by step the answer.
prof_dr_mr_obvious@reddit
It is not a problem they can't write without looking at reference material. That is what we all do all the time by looking stuff up online or documentation. And the same goes for errors. Learn them to look it up online like we all do.
What made me learn programming is first following the documentation of the language or software and as soon as I could start writing some functionality I thought of myself and constantly reference the documentation and look stuff up online.
The skill that would have come in handy was break down larger problems into smaller bits that I could wrap my head around. Maybe help them with that?
syklemil@reddit
I hope you're not giving your students the same wall of text with a couple of LLM smells. Learning to program is to a large degree also learning to structure your thinking; this should wind up being reflected in your writing.
Beyond that, teaching programming has been a known hard problem since the start. Lots of us wind up believing stuff like the retracted "the camel has two humps" paper because they feel true. Beyond the split between students who are eager and do a lot of exploration on their own and those who do the bare minimum, IME there seems to be some people who are just non-responders, in a similar vein as dyslexia, dyscalculia, aphantasia, and so on.
Which is to say, I don't have the answers, and while I haven't kept up with any research on teaching programming, I also don't have the impression that there's been any huge breakthroughs, and it just continues to be a hard task.
I do, however, generally believe in the point of the «Abstraction, intuition, and the “monad tutorial fallacy”» blog post, which is that the struggling is a necessary component of learning to program, just like consistent practice is in physical training. The brain is a physical organ, and it needs time to form new connections.
Students are going to continue to freeze up for new stuff, just like how someone learning to ride a bike for the first time (or trying click pedals for the first time) is likely to fall over. We just have to get them to get back on and try again, and continue training them.
Parking_Flounder_712@reddit
I am a final year cs student that started with a non coding background. My biggest issue with actually doing was not understanding what order to put things in! When the answer was in front of me, I could read it and it made sense, but I couldn’t look a blank screen and know what to start with. My biggest help was learning to block it out first, just focusing on each function or loop and getting the basic logic planning down first. I can sort of relate it back to learning how to write an essay: sure I can write a sentence, but how do I structure it correctly? Hope this helps, it’s really great that you care so much about your students.
lukkasz323@reddit
That's because programming is muscle memory
Ok_Chemistry_6387@reddit
Can you give an example of a problem? Also what level are you teaching?
8Erigon@reddit
You noticed the exact problem yourself so that‘s probably what you have to include in your lectures: Breaking down problems and errors. Include questions in your presentation/teaching.
Do group projects and just remove yourself from the classroom (or don‘t answer simple things, only when the compiler does unexpected stuff for some unknown reason)
so students have to figure it out themself but can still ask each other.
Let them make charts for. reaking down stuff before coding.
0dev0100@reddit
Give them the simplest coding exercises that are mostly a "copy this super simple thing" them part 2 of the exercise is "make it say 'hello universe' instead of 'hello world'"
They need to build up coding as a skill separately from interpreting a question or breaking down a problem.
What worked for me was "solving" problems where I had been given 90% of the answer, then 80%, then 70%, then 50%, then 0%