Overview

Students use and modify a series of simple apps to get familiar with a small set of programming commands. They observe the way the code and compare programs that run all at once to those that respond to user actions like buttons clicks. At the end of the lesson students discuss what they observed and are introduced to some key vocabulary for describing the running of programs.

Goals

Students will be able to:

Purpose

This lesson is written in an Investigate style, a common format of lesson that will be used in the remainder of the programming units. In this kind of lesson students are encouraged to investigate working code and make simple modifications to understand how it works.

This lesson introduces a number of concepts and vocabulary around what programs are and how they run that will need to be reinforced in future lessons.

Getting Started

Remarks


Teaching Tips

Get to the Activity: There's a lot to do in this lesson. Get to the main activity as quickly as you can.

Prompt Ideas: If you need a prompt for when students come in consider asking them to list 2-3 differences between a natural language and programming language and why those differences need to exist.


Activity

Group: Place students in pairs. One student per group should open the projects as they're needed for today's lesson, beginning with "Lesson6_App1".

Display: If possible in your room, display the projects at the front of the class.

Accessing the Projects: Just like earlier lessons, the apps for this lesson are available via the CSP-Widgets Repository. If you want a refresher on downloading and running the projects, check out the Getting Started with CSP Widgets help page.

Teaching Tip

Prepping for this lesson: The best way to prepare for this lesson is to go through the experience yourself. Check out each of the Lesson6 apps to get a sense for how they work. Then actually try to answer all the questions for each app.

Show code at the front: If your room allows it, display the code at the front of the room. When students mentions specific lines of code actually scroll to that line and read through it together.

Discuss specific lines of code: As you run discussions, model talking about programs by specifically calling out lines of code, as in "I can see that when the output code on line 2 runs, it produces a message in the console..."

Save modifications for the end: This lesson can be tight on time. Rather than have students modify the code all at once, you can save modifications for the end of the Code Investigation and have students pick a single app they wish to modify.

OK to Break Things: When using the widgets in earlier units it's not really possible to "break things". That's a little different than how things work here where it is possible to write code that may not run at all. Encourage students that this is ok.


App #1

Open a Project: Have students open the "Lesson6_App1" project. In the SourceCode folder, students should open "Main.quorum".

Activity: In their groups, students should do these tasks. Circulate the room making sure that pairs are actually discussing the prompt and are collaborating to modify the program. Once it seems all groups have had a chance to do this bring the class together.

  1. Run: Run the program to see what it does.
  2. Discuss: Why do you think some of the information is in quotes and some is not?
  3. Modify: Add two lines of code, one that displays a string and one that displays a number.

Discuss: Have students share the results of their discussions with the class. You do not need to use formal vocabulary yet, but make sure all students are seeing the same things.


App #2

Open a Project: Have students open the "Lesson6_App2" project. In the SourceCode folder, students should open "Main.quorum".

Activity: Students should do these tasks in the same way as last time. Once students have completed all three prompts bring the class together for a discussion.

  1. Run: Run this program to see how it works.
  2. Discuss: With a neighbor discuss the differences between SetScreenSize and AddPage. Be as specific as possible.
  3. Modify: Add one output command and one button property changing command to this program. (The property changing command can be one of the commands already used in this program or a command that students learned while designing their project apps.)

Discuss: Once again have students share the results of their discussions and modifications with the room. Here are some good points to draw out if they don't come up naturally in discussion.


App #3

Open a Project: Have students open the "Lesson6_App3" project. In the SourceCode folder, students should open "Main.quorum".

Activity: Have students complete these tasks, then bring the class together after a few minutes for another discussion.

  1. Run: Run the program to see how it works. Make sure you click the button on the screen.
  2. Discuss: How does the ButtonActivated section of code work? Be as specific as possible.
  3. Discuss: How do commands inside ButtonActivated run differently from commands in Start?
  4. Modify: Add one command inside Start and one command inside ButtonActivated.

Discuss: Once again have students share the results of their discussions and modifications with the room. Here are some good points to draw out if they don't come up naturally in discussion.


App #4

Open a Project: Have students open the "Lesson6_App4" project. In the SourceCode folder, students should open "Main.quorum".

Activity: Have students complete these tasks, and then bring the class together after a few minutes for a discussion.

  1. Run: Run this program to see how it works. Make sure you click both buttons.
  2. Discuss: How does the PlaySound command work?
  3. Discuss: How do lines that start with // run differently from the others
  4. Discuss: What's the difference between lines that start with // and lines that are between /* and */?
  5. Modify: Add code so the dog button makes sound too.
  6. Modify: Change the messages when each button is clicked.

Discuss: Have students share the results of their discussion and anything else they noticed. Here are good points to draw out.


App #5

Open a Project: Have students open the "Lesson6_App5" project. In the SourceCode folder, students should open "Main.quorum".

Activity: Have students complete these tasks, and then bring the class together after a few minutes for a discussion.

  1. Run: Run this program to see how it works.
  2. Discuss: How do you think the RandomNumber command works? Each time RandomNumber runs, there's a possibility of a different result!
  3. Discuss: Why do the birds move even if they're not clicked? Are there other options?
  4. Discuss: What happens when you press the space bar? Why does it happen?
  5. Modify: Make the birds move around the entire screen, not just the top left corner.
  6. Modify: Experiment with the other event actions besides MousedOver and KeyPressed. Which ones still make the game work?

Discuss: Have students share the results of their discussion and anything else they noticed. Here are good points to draw out.


Wrap Up

Prompt: Think about your experiences today and in the previous lesson. How is a programming language different from natural language?

Discussion Goal: Make this a quick discussion to help connect the previous lesson to this one. Help bring out some of the following points.


Remarks

Journal: Go through each of these vocabulary words and give students a chance to record each piece of information:


Teaching Tip

Reinforcing Vocabulary: A lot of the vocabulary introduced here is taken straight from the AP framework. The images are designed to help connect the definitions to the experiences they had in this lesson. Help students make these connections by not only writing down definitions but talking through how it's connected to what they saw.

Remarks

Assessment: Check for Understanding

Question: What is the difference between a sequential program and an event-driven program?

Standards Alignment