1.3 Algorithms

Enduring Understanding

      • Developers create and innovate using an iterative design process that is user-focused, that incorporates implementation/feedback cycles, and that leaves ample room for experimentation and risk-taking.

Essential Questions

      • What makes a computer a computer?

      • How do video games group the different actions for a player based on what key is pressed on the keyboard or controller?

      • How do apps group different actions together based on user interaction, such as pressing buttons?

      • What types of problems can be solved more easily with a computer, and what types can be solved more easily without a computer? Why?

Lesson Objectives

  1. Explain how a program or code segment functions.

  2. Identify input(s) to a program.

  3. Identify output(s) produced by a program.

  4. For errors in an algorithm or program: a. Identify the error. b. Correct the error.

  5. Identify inputs and corresponding expected outputs or behaviors that can be used to check the correctness of an algorithm or program.

Essential Knowledge

  1. A program is a collection of program statements that performs a specific task when run by a computer. A program is often referred to as software.

  2. A code segment refers to a collection of program statements that are part of a program.

  3. A program needs to work for a variety of inputs and situations.

  4. The behavior of a program is how a program functions during execution and is often described by how a user interacts with it.

  5. A program can be described broadly by what it does, or in more detail by both what the program does and how the program statements accomplish this function.

  6. Program input is data sent to a computer for processing by a program. Input can come in a variety of forms, such as tactile, audio, visual, or text.

  7. An event is associated with an action and supplies input data to a program.

  8. Events can be generated when a key is pressed, a mouse is clicked, a program is started, or by any other defined action that affects the flow of execution.

  9. Inputs usually affect the output produced by a program.

  10. In event-driven programming, program statements are executed when triggered rather than through the sequential flow of control.

  11. Input can come from a user or other programs.

  12. Program output is any data sent from a program to a device. Program output can come in a variety of forms, such as tactile, audio, visual, or text.

  13. Program output is usually based on a program’s input or prior state (e.g., internal values).

  14. A logic error is a mistake in the algorithm or program that causes it to behave incorrectly or unexpectedly.

  15. A syntax error is a mistake in the program where the rules of the programming language are not followed.

  16. A run-time error is a mistake in the program that occurs during the execution of a program. Programming languages define their own run-time errors.

  17. An overflow error is an error that occurs when a computer attempts to handle a number that is outside of the defined range of values.

  18. The following are effective ways to find and correct errors: § test cases § handtracing § visualizations § debuggers § adding extra output statement(s)

  19. In the development process, testing uses defined inputs to ensure that an algorithm or program is producing the expected outcomes. Programmers use the results from testing to revise their algorithms or programs.

  20. Defined inputs used to test a program should demonstrate the different expected outcomes that are at or just beyond the extremes (minimum and maximum) of input data.

  21. Program requirements are needed to identify appropriate defined inputs for testing.