Lesson: What Is a Program?

Contributed by: GK-12 Program, Computational Neurobiology Center, College of Engineering, University of Missouri

Side-view photo shows a young girl absorbed by what she sees on a laptop monitor screen.
Students discover what computer prgorams are
copyright
Copyright © 2004 Microsoft Corporation, One Microsoft Way, Redmond, WA 98052-6399 USA. All rights reserved. http://office.microsoft.com/en-us/images/results.aspx?qu=computer&ex=1#ai:MP900430487|

Summary

Students are introduced to the basic concepts of computer programs, algorithms and programming. Using a few blindfolds and a simple taped floor maze exercise, students come to understand that computers rely completely upon instructions given in programs and thus programs must be comprehensive and thorough. Then students learn to program using the LEGO® MINDSTORMS® software. They create and test basic programs, first using just the LEGO intelligent brick, and then using basic movement commands with the LEGO software on computers. A detailed PowerPoint® presentation, plus a worksheet and pre/post quizzes are provided.
This engineering curriculum meets Next Generation Science Standards (NGSS).

Engineering Connection

Engineers in all fields use computer programs to do calculations, run simulations, program machines and much more. Learning how to program is an essential skill for almost all engineers (and many others) as computers are used more and more often to tackle all sorts of problems. Engineers even design the computer programs that you use all the time on your own computer, such as Microsoft® Word® or Excel®. When you text message a friend, that is done by a computer program! An "app" is a computer program. iTunes is a computer program used to make playlists and play favorite songs. A computer program is also what alerts a car's driver if a seat belt is not fastened and alerts the police when a burglar trips a building alarm.

Pre-Req Knowledge

Ability to perform basic arithmetic, including addition, multiplication and division.

Learning Objectives

After this lesson, students should be able to:

  • Explain the meaning of a computer program.
  • Describe basic movement programs for the LEGO MINDSTORMS robot.

More Curriculum Like This

How Do You Make a Program Wait?

Building on the programming basics learned so far in the unit, students next learn how to program using sensors rather than by specifying exact durations. Working with the LEGO® MINDSTORMS® EV3 robots and software, they learn about wait blocks and how to use them in conjunction with move blocks set ...

How Do You Make Loops and Switches?

Students learn how to program using loops and switches. Using the LEGO® MINDSTORMS® robots, sensors and software, student pairs perform three mini programming activities using loops and switches individually, and then combined.

How Does a Touch Sensor Work?

Students learn about how touch sensors work, while reinforcing their similarities to the human sense of touch. They look at human senses and their electronic imitators, with special focus on the nervous system, skin and touch sensors.

What Is a Motor? How Does a Rotation Sensor Work?

Students learn about electric motors and rotational sensors. They learn that motors convert electrical energy to mechanical energy and typically include rotational sensors to enable distance measuring. Students create a basic program using the LEGO® MINDSTORMS® interface to control a motor to move a...

Educational Standards

Each TeachEngineering lesson or activity is correlated to one or more K-12 science, technology, engineering or math (STEM) educational standards.

All 100,000+ K-12 STEM standards covered in TeachEngineering are collected, maintained and packaged by the Achievement Standards Network (ASN), a project of D2L (www.achievementstandards.org).

In the ASN, standards are hierarchically structured: first by source; e.g., by state; within source by type; e.g., science or mathematics; within type by subtype, then by grade, etc.

  • Generate and compare multiple possible solutions to a problem based on how well each is likely to meet the criteria and constraints of the problem. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • Plan and carry out fair tests in which variables are controlled and failure points are considered to identify aspects of a model or prototype that can be improved. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • Evaluate competing design solutions using a systematic process to determine how well they meet the criteria and constraints of the problem. (Grades 6 - 8) Details... View more aligned curriculum... Do you agree with this alignment?
  • Analyze data from tests to determine similarities and differences among several design solutions to identify the best characteristics of each that can be combined into a new solution to better meet the criteria for success. (Grades 6 - 8) Details... View more aligned curriculum... Do you agree with this alignment?
  • Various relationships exist between technology and other fields of study. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • The design process is a purposeful method of planning practical solutions to problems. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • Test and evaluate the solutions for the design problem. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • The processing of information through the use of technology can be used to help humans make decisions and solve problems. (Grades 3 - 5) Details... View more aligned curriculum... Do you agree with this alignment?
  • New products and systems can be developed to solve problems or to help do things that could not be done without the help of technology. (Grades 6 - 8) Details... View more aligned curriculum... Do you agree with this alignment?
  • Specify criteria and constraints for the design. (Grades 6 - 8) Details... View more aligned curriculum... Do you agree with this alignment?
  • Describe how new technologies have helped scientists make better observations and measurements for investigations (e.g., telescopes, electronic balances, electronic microscopes, x-ray technology, computers, ultrasounds, computer probes such as thermometers) (Grade 5) Details... View more aligned curriculum... Do you agree with this alignment?
Suggest an alignment not listed above

Introduction/Motivation

(Be ready to show students the 43-slide What Is a Program? Presentation, a Microsoft® PowerPoint® file, to teach the lesson. In advance, make copies of the What Is a Program? Pre/Post Quiz, provided as attachments and slides, and the What Is a Program? Worksheet. Use a ruler and tape to prepare a simple maze on the floor in one corner of the classroom; see Figure 1. Student groups also need LEGO robot components, as described in the Background section.)

As computers are being used in more and more applications, the ability to program becomes very important in all activities and jobs. Programming is the way you tell a computer how to perform a task that you want it to do. If you think of all the "apps" available for smartphones, you realize that these programs do everything from sending messages to playing chess to performing bank transactions. Being able to program means that you can tell a computer how to tackle a unique problem that you otherwise would not be able to solve. For instance, astronauts would probably not survive long on the surface of Mars, but by programming rovers, researchers have been able to explore the planet's surface without endangering people. (Note: Refer to the Engineering Connection section for additional everyday programming examples.)

Programming is such a powerful tool because computers are able to store much more information and perform many more calculations much more quickly than humans can. For example, the use of computers and programming has it made it possible to generate computer models that are able to make predictions of how the weather might change—-something unimaginable for scientists to do otherwise.

(Continue by showing the presentation and delivering the content in the Lesson Background section.)

Lesson Background and Concepts for Teachers

This lesson presents the basics of programming and teaches students how to write programs that LEGO MINDSTORMS robots can follow. Emphasize the definitions of program and algorithm. As described below, present the lesson using the content provided in the slide presentation, divided into Day 1 and Day 2, two 50-minute sessions.

During the lesson, each group needs the following materials:

Alternative: LEGO MINDSTORMS NXT Set:

Note: This activity can also be conducted with the older (and no longer sold) LEGO MINDSTORMS NXT set instead of EV3; see below for those supplies:

  • LEGO MINDSTORMS NXT robot, such as the NXT Base Set
  • computer loaded with the NXT 2.1 software

Day 1: What is a Program? Presentation Outline (Slides 1-17)

  1. Administer the pre-quiz by handing out paper copies; the quiz is also on slide 2. The answers are provided for the teacher on slide 3 for discussion after students have completed the quiz.
  2. (slide 4) Talk to students about the pervasiveness of computers in our world, and all the different sorts of functions they perform for us. Introduce them to the idea that programming is the way you tell a computer how to perform a task that you want it to do.
  3. Clarify today's objectives: 1) investigate programs and algorithms—what are they? 2) become familiar with simple commands that are used in programs and 3) learn how to use the LEGO MINDSTORMS software to write programs that the LEGO robot can understand and execute.
  4. (slides 5-6) Introduce and define a program and an algorithm and give some examples. A program is a series of instructions written to direct a computer to perform a given task. An algorithm is a clear and specific procedure for solving a problem in a finite number of steps. When you write a program to perform a task, you are really designing an algorithm that will solve a problem.
  5. (slide 7) Then put it together: Programming is designing an algorithm to solve a problem. Emphasize that computers and robots are completely dependent on programs, and any mistakes in a program will lead to the computer or robot failing to complete the task in the way you intended.
    Three images. A photograph of a blindfolded girl standing with her arms at her sides. A floor plan diagram shows a U-shaped line with two of its sides parallel to the walls of a corner; from start to finish, the lengths of the U are 6 feet, 3 feet and 6 feet. A photo of a blindfolded boy walking with his arms outstretched in front of his body.
    Figure 1. Prepare for the lesson's mini-activity by using a line of tape to make s simple and short maze on the smooth floor in a corner of the classroom.
    copyright
    Copyright © (left) 2005 Tracee L. Jackson, U.S. Marine Corps via Wikimedia Commons; (middle) GK-12 Program, Computational Neurobiology Center, College of Engineering, University of Missouri; (right) North Carolina State Parks http://commons.wikimedia.org/wiki/File:Blindfoldlowres.gif http://www.ncparks.gov/Visit/parks/hari/pics/harp_maze.jpg
  1. (slides 8-12) Introduce a 10-minute mini-activity: Programing as an Algorithm. This is a two-part activity in which blindfolded student volunteers are guided by voice commands from other students on how to navigate a simple/short maze in one corner of the room that is made with tape on the floor (refer to Figure 1 or slide 8).
  2. For the first part of the mini-activity (slide 8), blindfold a volunteer student to serve as a "robot" and have him/her stand at the start of the maze, hands at her/his sides. Have another student volunteer, serving as the "programmer," give a series of commands (go forward two steps, turn right, etc.) to direct the "robot" to complete the maze.
  3. (slide 9) As a class, discuss what happened and share observations about how it went. Ask the following questions to give students something to think about:
  • Did the "programmer" get the blindfolded "robot" through the maze? How did it go?
  • Did the "commander" always tell the "robot" to go the correct number of steps?
  • Often, it is easier for the "programmer" to give instructions if s/he can tell the "robot" to go forward until s/he senses something. Why? (This way, the "programmer" does not have to worry about telling the "robot" exactly how many steps to move forward.)
  1. (slide 10) For the second part of the mini-activity, choose a new volunteer to be blindfolded. This time, permit the "robot" to stretch out his hands and arms in front of his body to sense when he is approaching a wall. Have another student give the commands to direct the "robot" to get through the maze. Now, commands such as such as "go forward until you hit a wall" are permitted.
  2. (slides 11-12) As a class, discuss what happened and make a few points. Summarize the mini-activity by highlighting the correlation between the preciseness and quality of the "program" or instructions given to the blindfolded student and the ability of the blindfolded student to complete the maze. Emphasize that, like a robot, the blindfolded student could not make his or her own judgments about where to go and if the programmer made a mistake, the maze would not be completed correctly.
  3. Next, introduce students to quick programming using the LEGO EV3 brick. Note: The brick has some basic features that allow the creation of simple programs without needing to program from a computer. Because only a few different options for commands are offered and the program can have at most five commands, this method of programming is generally not very helpful, but it is the best way to introduce students to programming.
  4. (slide 13) Turn on the LEGO MINDSTORMS Intelligent Brick by pressing the orange button, then use the arrows to the "EV3 Program" screen and select it with the orange button. Then press the orange button again. Now you can select one of several possible commands by scrolling with the arrow keys and pressing the orange button. Repeat four more times until the program has five blocks. Press the orange button to run the program.
  5. (slides 14-15) With the students, follow the slide instructions to make a simple program using only the LEGO brick. Then give students some time to clear the five slots and create their own simple programs. Doing this makes it clear to students that the LEGO brick is a small computer. However, quick programming on the LEGO brick has its drawbacks and limitations (slides 16-17). It provides only a narrow range of commands and a maximum of five, which is rarely adequate for designing programs to complete our tasks.

Day 2: Programming with MINDSTORMS Presentation Outline (Slides 18-41)

Programming using the LEGO MINDSTORMS EV3 software on a computer allows for many more possibilities, and is a powerful tool for students to learn to use. Slides 19-41 provide detailed information on how to write and download basic movement programs for the LEGO MINDSTORMS EV3 robot.

  1. With student pairs assembled at computers, hand out the worksheets and direct students to answer the questions and fill them in as concepts and information are covered in the presentation.
  2. Have students launch the software (slide 19) and open a program (slide 20). Orient them to the workspace (slide 21) and programming blocks (slide 22). Walk through the details of the "Move Block" features (slides 23-32), including port, direction, steering, power, duration and next action. The helpful hints (slide 32) are useful for estimating duration in almost any subsequent programs.
  3. (slide 33) Ask students to program an example task. Slides 33-39 provide instructions for how to break down the problem and create a program for the robot to complete the task. Then, slide 40 provides instructions for downloading the program onto the robot.
  4. Administer the post-quiz by handing out paper copies; the quiz is also on slide 41. The answers are provided on slide 42. This concludes the lesson. Slide 43 contains vocabulary terms and definitions. Next, conduct the associated activity.

Vocabulary/Definitions

algorithm: A clear and specific procedure for solving a problem in a finite number of steps.

iterate: Perform over again.

program: A sequence of instructions written to direct a computer to perform a task.

Associated Activities

  • Navigating a Maze - After learning how program development follows the steps of the engineering design process, student pairs create computer programs to navigate their LEGO robots through a maze on the floor created with cardboard boxes. To solve the design challenge, they apply their new understanding of "move blocks" to program the taskbots.

Attachments

Assessment

Pre-Lesson Assessment

Pre-Quiz: Before starting the lesson, administer the two-question What Is a Program? Pre/Post Quiz by handing out paper copies (also on slide 2). Students' answers reveal their base knowledge about programs and algorithms. Answers are provided on the What Is a Program? Pre/Post Quiz Answer Key (and slide 3). Administer the same quiz at lesson end.

Post-Introduction Assessment

Worksheet: On Day 2, have students complete the What Is a Program? Worksheet while the teacher delivers the presentation content. At the end of Day 2, collect and review the worksheets to assess student understanding of the lesson concepts.

Lesson Summary Assessment

Post-Quiz: At lesson end, administer the What Is a Program? Pre/Post Quiz again by handing out paper copies (also on slide 41). Compare students' answers to their pre-quiz answers to assess how well they learned the concepts during the course of the lesson. Answers are provided on the What Is a Program? Pre/Post Quiz Answer Key (and slide 42).

References

EV3 User's Guide. Accessed Jul 17, 2016 http://why.gr/wp-content/uploads/2015/03/EV3-User-Guide-EN.pdf

Contributors

Riaz Helfer, Pranit Samarth, Satish S. Nair

Copyright

© 2014 by Regents of the University of Colorado; original © 2013 Curators of the University of Missouri

Supporting Program

GK-12 Program, Computational Neurobiology Center, College of Engineering, University of Missouri

Acknowledgements

This curriculum was developed under National Science Foundation GK-12 grant no. DGE 0440524. However, these contents do not necessarily represent the policies of the National Science Foundation, and you should not assume endorsement by the federal government.

Last modified: June 6, 2017

Comments