> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# What is a Program

> Describes what a program is, the input process output model, and the qualities of good programs including correctness, efficiency, readability, and robustness

Welcome back.

Before we write any code, consider two important questions:

* What actually is a program?
* What makes a good program?

Answering these will help you begin to think like a programmer. By the end of this lesson you'll be able to define what a program is, describe the Input-Process-Output model (IPO), and identify the core qualities of well-written programs.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1dy8tS90R7SDJy5v/images/Programming-Fundamentals/Building-Computer-Programs/What-is-a-Program/program-definition-input-process-output-steps.jpg?fit=max&auto=format&n=1dy8tS90R7SDJy5v&q=85&s=0ba3cc4bf9a0c12854937ed637e633a4" alt="The image shows a text list describing steps about defining a program, the Input-Process-Output model, and identifying qualities of a good program, alongside an animated cat character and a person speaking." width="1920" height="1080" data-path="images/Programming-Fundamentals/Building-Computer-Programs/What-is-a-Program/program-definition-input-process-output-steps.jpg" />
</Frame>

What is a program?

A program is a clear, ordered set of instructions that tells a computer how to perform a task. The computer follows those instructions step by step. A helpful analogy is a recipe: gather ingredients, follow steps in order, and bake for the required time.

Example: making a cake — add flour and eggs, mix, and bake for 30 minutes. Follow the steps and you get a cake. Programs work the same way: they take information (input), do something with it (process), and produce a result (output).

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1dy8tS90R7SDJy5v/images/Programming-Fundamentals/Building-Computer-Programs/What-is-a-Program/kodekloud-speaker-baker-cake-decoration.jpg?fit=max&auto=format&n=1dy8tS90R7SDJy5v&q=85&s=67cde7bf864c8ce8c0a97c0416cda77f" alt="The image shows a person in a black shirt with the &#x22;KodeKloud&#x22; logo speaking, alongside an illustration of a baker decorating a cake with ingredients being poured into a bowl." width="1920" height="1080" data-path="images/Programming-Fundamentals/Building-Computer-Programs/What-is-a-Program/kodekloud-speaker-baker-cake-decoration.jpg" />
</Frame>

Input → Process → Output: the IPO model

Every program follows the IPO model. When designing software, explicitly identify:

* Input — what information the program needs
* Process — how the program transforms or uses that input
* Output — what the program should return or display

Here are a few concrete examples organized with the IPO model:

| Program | Input | Process | Output |
| -: | :-: | :- | :-: |
| Calculator | `5 + 3` | add the two numbers | `8` |
| Weather app | your location | fetch weather data for that location | current temperature and forecast |
| Instagram-like app | a photo you upload | apply filters and save | the filtered photo visible to followers |

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1dy8tS90R7SDJy5v/images/Programming-Fundamentals/Building-Computer-Programs/What-is-a-Program/weather-app-smartphone-screens-hyderabad.jpg?fit=max&auto=format&n=1dy8tS90R7SDJy5v&q=85&s=cc6816fd629f7190c436118342fbea3d" alt="The image shows a person standing next to three smartphone screens displaying a weather app with a gradient background. The app shows a search bar with &#x22;Hyderabad,&#x22; a loading screen, and a weather forecast with sunny conditions." width="1920" height="1080" data-path="images/Programming-Fundamentals/Building-Computer-Programs/What-is-a-Program/weather-app-smartphone-screens-hyderabad.jpg" />
</Frame>

Design checklist (quick)

<Callout icon="lightbulb" color="#1CB2FE">
  When planning a program, ask: `What inputs do I need?` `How will I process them?` `What output should I produce?` Writing these down before coding makes implementation clearer and reduces rework.
</Callout>

What makes a good program?

1. Correctness
   * The program produces the right result for valid inputs.
   * Test edge cases and typical uses to ensure consistent behavior.

2. Efficiency
   * Use time and memory wisely. Prefer solutions that solve the problem with minimal, necessary work.
   * Avoid unnecessary repetition; refactor duplicate logic into reusable functions.

3. Readability
   * Code gets read more than written. Use descriptive names, consistent formatting, and concise comments that explain *why* a decision was made.
   * Readable code makes collaboration and future maintenance much easier.

4. Robustness
   * Handle unexpected or invalid inputs gracefully. Provide useful error messages (for example, "Please enter numbers only") and ways to recover.

Summary table — qualities at a glance:

| Quality | What it means | Quick tip |
| -: | :- | :- |
| Correctness | Produces correct results consistently | Add unit tests and validate inputs |
| Efficiency | Uses resources and time sensibly | Choose appropriate algorithms and data structures |
| Readability | Easy for humans to understand and maintain | Use clear names, small functions, and comments |
| Robustness | Handles errors and unexpected inputs gracefully | Validate input and handle exceptions |

To recap: a program is a step-by-step set of instructions (like a recipe). All programs follow the IPO model: take input, process it, and produce output. A good program is correct, efficient, readable, and robust.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/1dy8tS90R7SDJy5v/images/Programming-Fundamentals/Building-Computer-Programs/What-is-a-Program/programming-instructions-ipomodel-qualities.jpg?fit=max&auto=format&n=1dy8tS90R7SDJy5v&q=85&s=062abc78fff745bf3766c3ce0275be8b" alt="The image shows a person standing in front of three points about programming, discussing step-by-step instructions, the IPO model, and qualities of a good program." width="1920" height="1080" data-path="images/Programming-Fundamentals/Building-Computer-Programs/What-is-a-Program/programming-instructions-ipomodel-qualities.jpg" />
</Frame>

Okay — that's enough explanation. Let's write your first program.

Links and references

* [Programming Basics — Introduction and Concepts](https://www.freecodecamp.org/news/what-is-programming/)
* [Algorithmic Complexity — Big O notation](https://en.wikipedia.org/wiki/Big_O_notation)
* [Clean Code Principles](https://en.wikipedia.org/wiki/Code_readability)

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/programming-fundamentals/module/b7e10a6f-82c0-4b55-a099-66ea1a6d06d4/lesson/f9fff9d2-edb4-4753-8102-d9753b191429" />
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.