Welcome 🤗! In the next ~4h we will cover:
A pattern consisting of 80 lines. You will later draw it as Exercise 7.
Before we begin with the class:
we need two Feedback persons.
Hvis du har mistet et eller flere forsøg, skulle du have modtaget en mail
Efter feedback: jeg vil afsætte mere tid til programmeringsopgaver.
Jeg har tilføjet deadlinen for project proposal Semester schedule 📆
Answer the poll in 📊 Live poll: How much time did you spent for homework and preparation?
How do you like the book?
Test¶
(20 min)
Preparation review¶
Pair programming¶
Learning goals:
Describe the responsibilities of the driver and the navigator, and when to switch
Act as driver by narrating what you are typing and why
Act as navigator by asking guiding questions and catching mistakes without taking over the keyboard
Give your partner constructive feedback and reflect on what you learned from them
Two people, one computer, one problem. We have two roles: driver who codes and the navigator who supports.

Source: Teaching Programming, MIT license
Why?
Explaining is how you learn. Programmers even explain their code to a rubber duck, if noone is around.
Pairing is especially helpful for students with less prior experience.
More experienced students profit by being forced to slow down and think about what their code does and why.
This is a workplace skill. Pair programming comes from professional software teams.
⌨️ Driver
Types the code
Focuses on the syntax and immediate line
Dictates what she/he is doing and why.
🧭 Navigator
Doesn’t touch the keyboard
Ask questions rather than making demands.
Thinks about the bigger picture — logic, bugs, what’s next
Asks questions, catches mistakes, suggests ideas
What if a group of 3?
Still one driver, and this role rotates.
Multiple navigators. They do the same job.
Rules
Commit for at least 1 hour.
Switch roles every 10 minutes.
Talk out loud, constantly.
Navigator doesn’t grab the keyboard. If you see a typo, say it.
Be kind.
❌ do not: You’re doing that wrong
✅ instead: What if we tried?
Before you start
Read the problem together out loud.
Agree on a plan before any code gets written.
The 🟥 red color or the lower number drives first.
If you get stuck
Navigator: ask a question instead of giving the answer.
Still stuck after few minutes? Raise a hand for help 🤚.
At the end
Ask each other:
What did you learn from your partner?
What would you do differently next time?
For the teacher/TA
Stop the time for two first one-two times.
Check that the driver role is rotating.
Making sure that groups don’t go silent.
Watch for a student who never speaks; ask a low stakes question to the group rather than singling them out.
Timer¶
Learning goals¶
use decision structures like
if, `if-else``use Boolean logic to describe conditions
Coding - Decision Structures and Boolean Logic¶
E: Ordering ids¶
E: Day of the week¶
E: Friends’ dietary requirements¶
Temperature check 🌡️¶
How do you feel with the concepts we introduced so far? 📊 Live poll
I feel confident and ready to move on at similar pace by introducing new concepts.
I would rather have more exercises and less introduction of new topics.
I don’t know
Coding - Repetition¶
use repetition structures like
forandwhileloopsuse loop control statements like
breakandcontinueuse sentinel values to terminate a loop
E: Bug collector¶
See book ch4 p.255 Exercise 1
E: Sum of numbers¶
See book ch4 p.256 Exercise 8
E: Pattern using nested loops¶
See book ch4 p.258 Exercise 13
E: Drawing repeating squares¶
See book ch4 p.258 Exercise 15
E: Reflection¶

Source by VenkatRaman2