Nau mai, haere mai ki te whārangi "Computer Program"! This page will teach you what a computer program is and how it uses algorithms to make digital devices perform tasks.
Define what a "computer program" is.
Explain the relationship between algorithms and computer programs.
Understand the role of programming languages in creating programs.
Identify basic components of a simple computer program.
Explain how programs enable digital devices to function.
To get the most out of learning about Computer Programs, it's essential to have a clear understanding of:
Digital Devices: Do you know what digital devices are and how they operate with Input, Process, and Output?
Software & Applications: Do you understand that software provides instructions to hardware, and applications are a type of software?
Operating Systems: Are you aware of the master software that manages hardware and runs applications?
Algorithms: Do you know that an algorithm is a set of step-by-step instructions for solving a problem?
Sequence: Do you understand that the order of instructions matters in a process?
Quick Check: If an algorithm is a recipe, what do you think the actual dish, cooked and ready to eat, represents in the digital world?
A computer program, often simply called a "program" or "code," is a precise set of instructions written in a programming language that a digital device (like a computer, smartphone, or tablet) can understand and execute. Programs tell the hardware exactly what to do, step-by-step, to achieve a specific task or solve a problem.
Every software & application you use – from games and web browsers to photo editors and social media apps – is a complex collection of computer programs.
A computer program is essentially an algorithm translated into a language that a computer can understand.
The algorithm is the logical plan or recipe (e.g., "how to make a sandwich").
The computer program is the specific way that recipe is written down for a machine to follow (e.g., the step-by-step instructions in a programming language).
Computer programs work within the Input → Process → Output cycle of a digital device. They control how the device takes input, what it does with that input (the "process"), and what kind of output it produces.
Programs are written by human programmers using various programming languages (a type of Formal Language). These languages have specific rules (syntax) that the computer understands.
When you run a program (e.g., click an app icon), the Operating System loads the program's instructions into the computer's memory. The CPU then starts executing these instructions one by one, following the defined sequence.
The program's instructions tell the hardware (like the screen, keyboard, speakers, or processor) what to do. For instance, a game program might tell the graphics hardware to draw a character on the screen, or tell the sound hardware to play music.
Programs use logical constructs like Selection (making decisions using Comparison Operators and Logical Operators) and Iteration (repeating actions) to perform complex tasks. They use Variables to store and manipulate data.
Ultimately, a computer program brings an algorithm to life, allowing a digital device to solve problems or perform tasks for an end-user.
Activity 1: Decomposing a Program
Task: Think about a simple program or app you use, like a calculator app or a basic game (e.g., Tic-Tac-Toe).
Activity:
Describe the main purpose of the program.
Using your knowledge of Decomposition, break down the program's overall function into 3-4 major steps or smaller parts that the program would need to handle.
For each major step, briefly describe what kind of input it might take and what output it might produce.
Evidence: Create a Google Doc or Google Slide outlining your program's decomposition and its inputs/outputs.
Activity 2: Simple Program Flow
Task: Imagine you are writing a very simple program for a smart light bulb. The light bulb can only understand two commands: TURN_ON_LIGHT and TURN_OFF_LIGHT.
Activity:
Write a simple algorithm (using clear steps) for a program that:
Starts.
Turns the light on.
Waits for 5 seconds.
Turns the light off.
Ends.
Then, consider how you might add a Selection (if/else) rule: "If it's daytime, don't turn on the light." How would that change your algorithm?
Evidence: In a Google Doc, write your original sequenced algorithm and then show how it changes with the added Selection rule.
Check your understanding of Computer Programs.
Multiple Choice: Which statement best describes the relationship between an algorithm and a computer program?
a) An algorithm is a physical device, and a program is software.
b) An algorithm is the logical plan, and a program is that plan written in code for a computer.
c) They are two completely separate concepts with no connection.
d) A program is only for games, and an algorithm is for serious tasks.
Short Answer: Name two examples of everyday applications that are essentially complex computer programs.
Scenario: A smart refrigerator has a program that monitors its internal temperature. If the temperature goes above a certain level, it displays a warning on its small screen and sends a notification to your phone.
How does this program use Input?
How does this program use Output?
Which programming logic concept (like Selection or Iteration) is likely being used when the program decides whether to display a warning?
A computer program (hōtaka rorohiko) is a set of instructions written in a programming language that a digital device executes.
Programs are the translation of algorithms into code.
They control Input, Process, and Output on digital devices.
Programs use fundamental logical constructs like Sequence, Selection, and Iteration, and manipulate Variables.
Now that you understand what computer programs are and how they work, you're ready to dive deeper into the fascinating world of coding and computational thinking:
Variable: Explore how programs store and manage data that changes.
Comparison Operator: Learn how programs compare values, which is essential for making decisions.
Logical Operator: Understand how to combine different conditions to create more complex decisions in programs.
Selection: Discover how programs make choices and take different paths based on conditions.
Iteration: Explore how programs efficiently repeat sections of code multiple times.
Formal Languages: Learn more about the specific rules and syntax of programming languages used to write computer programs.
Sorting Algorithms: See how algorithms, implemented as programs, can efficiently organize data.
User Interface (UI): Discover how programs create the visual parts of software that users interact with.
Computer Security: Understand how programs need to be written securely to protect data and systems.
Encryption: Learn how programs use encryption algorithms to keep information secret.
Error Control: Explore how programs are designed to detect and handle mistakes in data.
Complexity and Tractability: Analyze how the efficiency of a program's underlying algorithms impacts its ability to solve problems within a reasonable time.
Artificial Intelligence (AI): Understand that AI systems are advanced computer programs that can learn and solve complex problems.
Big Data: See how programs are essential tools for processing and analyzing massive datasets.
Embedded Systems: Discover specialized computer programs that are built into other devices to perform specific tasks.
Data Transmission: Learn how programs handle the sending and receiving of data between devices.
File Types: Understand how programs create, open, and manipulate different kinds of files.
File Management: Explore how programs interact with file systems to store and retrieve data.
Computer Vision: Discover how programs process visual input to "see" and interpret the world.
Computer Graphics: See how programs generate and display visual output.
Network Communication Protocols: Understand the rules programs follow to communicate across networks.