Unit 3 - Algorithms and Programming
Some of the lessons that follow have worksheets and student guides associated with activities. Those worksheets are listed in the relevant lesson plan, or you can check out all unit 3 student-facing activity guides here.
- Why do we need algorithms?
- How is designing an algorithm to solve a problem different from other kinds of problem solving?
- How do you design a solution for a problem so that is programmable?
- What does it mean to be a "creative" programmer?
- How do programmers collaborate?
- 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.
- 2.2 Multiple levels of abstraction are used to write programs or create other computational artifacts
- 4.1 Algorithms are precise sequences of instructions for processes that can be executed by a computer and are implemented using programming languages.
- 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.
Students write instructions for building a small arrangement of LEGO® blocks and trade with a classmate to see if they can follow them to construct the same arrangement. The lesson highlights the inherent ambiguities of human language deriving the need for a well-defined programming language which leaves no room for interpretation.
Student Links: Video | Activity Guide | Activity Guide |
Students develop (and are eventually provided with) commands for a "Human Machine Language" designed to perform operations on playing cards. The lesson highlights the connection between programming and algorithms by showing that different techniques for solving the same problem can be expressed in the language.
Teacher Links: Answer Key | Answer Key Student Links: Activity Guide | Activity Guide
Concept Invention | Unplugged | Algorithms
Students continue to work with the “Human Machine Language” - with an added SWAP command - to design an algorithm to move the minimum card to the front of the list. Students may design more algorithms for other problems and challenges provided.
Teacher Links: Answer Key Student Links: Activity Guide | Video
Students use the App Lab programming environment for the first time and become acquainted with the turtle. The chief problem is to find the most “efficient” way to draw an image of a 3x3 grid using a limited set of only 4 commands.
Teacher Links: Multiple Choice Student Links: Video |
Students learn to define and call their own procedures (or “functions”) in order to create and give a name to a group of commands for easy and repeated use in their code. Named procedures are a form of abstraction that enable the programmer to reduce complexity by removing details and generalizing functionality.
Teacher Links: Multiple Choice Student Links: | Video
Students learn about top-down design strategies for solving more complex programming problems by breaking the problem down into small parts that can be named and represented as functions. The code in the resulting program should read more like a description of how to solve the problem than like raw code.
Student Links: | Worksheet
Students read and use App Lab’s API documentation to learn about new turtle commands that they must use to complete a series of drawing puzzles.
Students practice using and creating functions with parameters by making a series of modifications to a program that creates an “Under the Sea” drawing. Students add parameters to generalize behavior that can vary, and make use of App Lab's randomNumber function add variation to the scene.
Student Links: Video
Students learn to use a simplified version of a for loop to add repetition to their code (i.e. repeat x times loop). Calling functions repeatedly with a loop combined with random numbers enables students to create more complex and varied drawings for digital scenes.
Teacher Links: Forum | Multiple Choice Student Links: | Video
Students work in groups of 3 or 4 to design and write the code for a program that draws a digital scene of their choosing. Students break the scene down into small parts and divvy up the code writing amongst the team. Each individual's code is combined at the end to create the full scene. The project concludes with written reflection questions similar to those students will see on the AP® Performance Tasks.
Unit 3 Chapter 1 - What’s the story?
In the unplugged activities we derive the need for programming languages first, and then focus on how to express algorithms using them. Algorithms are building blocks for solving computational problems. You can design them to solve individual small tasks and then combine them and recombine them to solve others. Furthermore, there is a good deal of creativity involved in designing algorithmic solutions to problems. It may come as a surprise that, given only a few machine instructions and a simple problem, two people may write code to solve it in completely different ways. This might be because their overall approach (algorithm) is different or simply because they went about writing code to express it differently.
Our approach to the Content
To call programming a creative form of personal expression sounds counterintuitive to a lot of beginners. Our hope is that this fact resonates with new students since we see it as illustrating our teaching philosophy of computer-science-as-a-liberal-art. The mindset is expressed eloquently by Donald Knuth: “Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do.” It is with this sentiment in mind that we start the unit by doing just that - writing out algorithms to be executed by hand to gain insights into what makes programming challenging and creative. The unplugged activities reveal why programming languages need to exist, and foreshadow some of the ideas that come later in this unit and throughout the course. They serve as a common point of reference that many future lessons can be tied back to.