Wiki Page, MsFernandezAP-CSP-2016-2017: Lesson Plan: Introduction to Built-in Functions and Expressions

Wiki Page
2016-07-26T16:10:18-06:00

Lesson Overview

This lesson plan is designed as a pre-introduction to Module 7: Calculating Realism, which is an introduction to mathematical expressions and functions.

This lesson plan is based upon the "Learning to Program With Alice" (3rd Ed) book by Dann, Cooper and Pausch, Chapter 3 "Programming: Putting together the Pieces".

Chapter 3 teaches students "how to put together different kinds of program code "pieces" to make the program do what they instruct them to do. Included in Chapter 3 are the following Computer Science topics:

Built-in functions and mathematical expressions.

Simple Control Structures, specifically:

conditional statements or "If-statements".

Relational Operators, or the six built-in functions

Loops

This lesson will focus only on built-in functions and math expressions.

CS Principles Framework

Big Ideas | Enduring Understandings

1. Creativity

1.1 Creative development can be an essential process for creating computational artifacts.

1.2 Computing enables people to use creative development processes to create computational artifacts for creative expression or to solve a problem.

1.3 Computing can extend traditional forms of human expression and experience.

2. Abstraction

2.2 Multiple levels of abstraction are used to write programs or create other computational artifacts.

2.3 Models and simulations use abstraction to generate new understanding and knowledge.

4. Algorithms | 4.1 Algorithms are precise sequences of instructions for processes that can be executed by a computer and are implemented using programming languages.

5. Programming

5.1 Programs can be developed for creative expression, to satisfy personal curiosity, to create new knowledge, or to solve problems (to help people, organizations, or society).

5.2 People write programs to execute algorithms.

5.3 Programming is facilitated by appropriate abstractions.

5.4 Programs are developed, maintained, and used by people for different purposes.

Connected Student Lesson

This lesson is connected to the Built-in Functions and Expressions: Programming: Putting Together the Pieces.

Student Learning Objectives

By the end of this lesson, students should be able to:

Describe/Explain Functions.

Functions are statements that can be used to in Alice to ask questions about properties of the World or properties of an object within it.

Functions can also be used to compute a value.

Explain that when a function is called, it returns a particular type of value. This value can be a:

number (e.g. 5 or -19.5)

Boolean value (true or false)

string (e.g., "hello world")

object (e.g., a spiderRobot)

Describe/Explain Expressions.

An expression may use an arithmetic operation (addition, subtraction, multiplication, division) to compute a numeric value.

Assessment/Evidence

Students will be able to reproduce the FirstEncounterWithMethods Alice World Submission by adding the simulated "spiderRobot moves forward as the legs walk".

If you did not ask the students to do this programming exercise or assignment, then you can have them start with the following Alice world: LopezAFirstEnounterDistanceFunctionSetup.a2w

At the end of the instructions, the students should reproduce the following Alice World: FirstEnounterDistanceFunctionCompleted.a2w

Google Portfolio Reflection.

Students will reflect on their success or non-success (challenges, barriers) of reproducing the FirstEnounterDistantceFunction Alilce World using built-in functions and expressions.

Students will relate the big ideas with this programming exercise.

Preparation/Materials

For this exercise, you will need the following materials:

Presentation system (LCD projector or Interactive SmartBoard, computer, Internet access)

LTPWA PowerPoint for Built-In Functions and Expressions: Ch03Lec1RobotExampleLopezA.ppt

Alice World: LopezAFirstEnounterDistanceFunctionSetup.a2w (rename the world without my name included in the file name)

Completed Alice World:

Lesson Review

I did this lesson with the following steps. You can certainly adapt and do it any way you like, but I thought this worked out pretty well with my students!

1. Hook/Motivation (5 minutes): up to this point, students have created Alice worlds or programs with methods, parameters, and events.

1. I describe to students that in order to make interactive stories, video games, or any program that uses simulations or models, seem realistic, they have to use functions and mathematical expressions to do this.

2. I use video games, such as the "WI" (I avoid violent shooter video games) or simulation programs used for training pilots, doctors or any other program approach, such as Global Climate Change of Mapping the Universe, to describe the importance of using built-in functions or expressions for realism.

3. Ask students for examples of how they can make programs more realistic using built-in functions and expressions.

2. Lesson: Use the following PowerPoint to explain Built-in Functions and Expressions: Ch03Lec1RobotExampleLopezA.ppt; Please Do Not Share this out with students! Review the PowerPoint lesson before you use with students.

1. I only use slides 1 -10. I stop at slide 11.

2. Review the vocabulary.

3. Students create the First Encounter using the Distance Function with this program.

1. Provide student access for the LopezAFirstEnounterDistanceFunctionSetup.a2w Alice world.

2. Teacher demos each step and students follow along. Describe to students that you performing pair programming with them.

3. Allow students to help each other out as you complete this program. Ask them guiding questions about what they are doing or if they have questions, have them ask.

4. Let them explore with other functions and expressions.

Steps for Creating the Program

1. Have students open the LopezAFirstEnounterDistanceFunctionSetup.a2w.

2. Tell the students to rename the file if you want them to include their name on the file.

3. Describe to students the scenario. "Although we have the spiderRobot moving toward the alien, let us make it more realistic. Functions allow you to get information such as the distance from the spiderRobot to the rocks or the distance from the spiderRobot to the lunarlander."

4. Have the students do the following.

1. Open the Investigate method.

2. Select the spiderRobot from the Object tree and then its functions tab.

4. Describe the following subcategories within the built-in functions:

1. Proximity: how close the object is to some other object in the world (such as distance to, distance above).

2. Size: dimensions such as height, width and depth, and how these compare to the dimensions of another object in the world.

3. Spatial Relation: orientation compared to another object in the world (such as to left of, to right of).

4. Point of view: position in the world.

5. Other: miscellaneous items such as the name of a subpart of the object.

5. In the First Encounter world, the spiderRobot wants to get closer to the alienonwheels. Problem: we do not know exactly how far away the spiderRobot is from the rocks where the alien is hiding.

6. We can find out how far the spiderRobot is by trial and error, moving the spiderRobot different distances to the rocks and alienonwheels, but there is a more efficient way.

7. Let us use the function to ask the question: "What is the spiderRobot's distance to the rock where the alienonwheels is hiding?".

8. Alice will return the value of the distance in meters.

9. Drag the spiderRobot's distance to function tile into the editor and drop it on top of the 1 meter distance of the spiderRobot move forward tile.

11. Select rock as the target object.

12. Press Play to test.

13. Problem! There is a collision between the spiderRobot and Rock. Ask students why this is happening.

1. Answer: A collision occurs because the distance to is measured from the spiderRobot's center point to the rock's center point.

2. How can we avoid a collision? Use a (mathematical) expression to adjust the distance.

14. Ask the students if they can come up an idea for a solution to this problem.

15. The rock is bigger than the spiderRobot. If the width of the rock is subtracted from the distance between the two objects, then we adjust the distance further by subtracting an additional small amount, a collision can be avoided.

1. Tricky part or tip: we need to provide a placeholder where we can place a number so that we can build the expression.

2. Let us first select the math operator minus by doing the following.

1. Click on the far right down arrow of the spiderRobot distance to rock function.

3. From the pop-up menu, select math.

4. Select spiderRobot distance to rock - >.

5. Select 1; the number does not matter; it is a place holder.

7. TIP: The reason we selected 1 is because we can now replace the 1 with any of the functions that are available on Alice.

8. We will now substitute the rock's width function where the 1 is located at.

9. Select the rock object in the Object Tree.

10. Make sure the Function tab is selected.

11. Select the rock's width function tile.

12. Drag and drop the rock's width function tile into the -1 placeholder.

14. Press Play to test.

15. Now the spiderRobot moves forward to the rock without a collision.