Teaching Python

We're two middle school teachers learning and teaching Python

Active Learning Code-Alongs

Open the doors of a classroom, and what do you see? Do you see students sitting in rows facing forward with the Teacher or projector at the center of the learning? Are students passively scribbling on paper or typing silently behind their computers? Or do you see movement, hear chatter, feel the fluidity of the lesson? Is there a transition of typing, talking, and listening throughout the class? Is the learning active?

Bonwell and Eison (1991) described Active learning as a "process of engaging students in "doing" activities". It is a multimode process of delivering topics, knowledge and engaging students in a deeper understanding of topics. Active learning is a unique technique but sometimes it is difficult for students and teachers to begin. (To learn more about Active learning check out The Center for Teaching at Vanderbilt article Active Learning

There are many reasons why active learning is not used often in classrooms:

  • Teachers must change their roles as knowledge experts to experienced mentors.
  • Active learning lessons take more time to plan and to teach.
  • Active learning requires students to transition their role as passive recipients into active risk-takers in the learning process, and this is sometimes a difficult transition for students.

Active learning takes commitment, and it is often easier to slip into a 'content expert role' in a computer science course. Instructors can get hooked into demonstrating cool tricks and code chunks that seem to flow with ease; and teachers can cover more topics in a shorter period of time. However, students may be quickly copying the instructor's code, but they may not have time to process or "chew" into the topics.

Although computer science teachers may feel that the students are engaged with code alongs, the lessons' copying and coding techniques may resemble old-school lecture and note-taking activities from other curricula, resulting in less learning than originally planned. This lecturing resembling activity can result in computer science classes becoming a face forward, rote learning experience instead of an active one.

So how can Computer Science teachers change necessary code-along sessions into highly engaged active learning experiences?

The code-along activity can become an incredible active learning experience. It can be a high engagement activity that propels student understanding to a new level. A typical "I code, and you copy" event becomes a brainstorming, questioning, discussion, demonstration, and highly motivating experience! (To learn more about Active learning activities check out Queens University Course on Active Learning Strategies. )

So how do you start planning for an active learning code-along? (If this is your first time using active learning exercises, make sure you know your students, have established rapport, and student norms are explicit.) Consider these questions as you are preparing your active learning lesson.

  • When preparing an active learning lesson, these questions are useful for planning:
  • What is the most important thing to remember is your lesson's objective?
  • What is the goal of the lesson?
  • How will you know that learning happened?
  • What will you assess?
  • What do the students already know?
  • How long will the lesson take?
  • What level of understanding do you want to achieve?
  • What are the desirable difficulty levels for the students?
  • What activities will you use to teach the concepts?

Let us use simple functions as an example:

  • Objective: Functions can be used to repeat an activity in your code and use them successfully to complete a specific repetitive task.

  • Prior Knowledge/Activities: Sample exercises, definitions, example code

  • Goal: Develop a generic "app" that has multiple functions.

  • Assessment: Students will manipulate the final code and add their flair.

  • Lesson duration: 45 minutes

  • Level of Understanding: Understand the importance of functions, can see the benefit to using them, can use basic functions in code.

  • Hook(Brainstorm): Ask students what to make: Give suggestions, a contact app, a friends app, a birthday info app, etc. The hook helps you connect on a topic that interests the students, and by providing some suggestions, in the beginning, you can guide the suggestions to ensure that functions will work well with that topic.

  • Possible Activities:

    Think aloud: Work together as a large group, one student explains one step on how to complete the app, and another student writes out the steps needed(in Pseudocode) to make the app. Ensure that you call on as many students as possible.

    Peer Instruction: The Teacher starts by asking a question, What would be a good name to define the function for _____? Give students few minutes to make a function name for all the steps designed during the think-aloud. Then call on students to define the function's name with "pass" and write these down for the code. Guide the names that are not descriptive, and check syntax.

    Work together in groups: Assign a function for each group to write a docstring for. Share.

    Pause procedure: Use the pause procedure to add wait time between posing questions and waiting for a response. Students will often wait and allow the teacher/coder to code for them. Be prepared to wait extra time initially and make sure that the same students are not solving all the coding challenges.

    Demonstrations: The Teacher begins coding on a particular function, demonstrates how to look up library methods and functions, for example, using the datetime documentation, or the Teacher can force code errors and challenge students to fix the code.

    Retrieval practice: Code some, and wait. Seek out responses and quick check-ins for students to recall previous concepts. For example, Teacher says, "This function needs a keyword argument. Why do you think this is true?" Have students recall what a keyword argument is, have them explain why and their reasoning."

These are just some activities that can be incorporated easily into a code-along lesson during Computer Science. What other ways can you turn your code-along activities into something more active?

“Give a man a fish you feed him for a day. Teach a man to fish and you feed him for a lifetime.”


Game, Prodigy. “8 Active Learning Strategies and Examples [ Downloadable List].” Prodigy Education, [www.prodigygame.com/main-en/blog/active-learning-strategies-examples](www.prodigygame.com/main-en/blog/active-learning-strategies-examples)