#designTools #IPO [[Outcome 1 - Programming#3. design tools for representing modules, including|U3 - AOS1 - KK3]] ### What is an IPO? The "Pizza Oven" Analogy Imagine a pizza shop. You cannot get a cooked pizza without ingredients, and the ingredients won't cook themselves. - **Input:** Dough, cheese, tomato sauce, pepperoni. - **Process:** Roll dough, spread sauce, add toppings, bake at 200°C for 15 mins. - **Output:** A hot, cooked pepperoni pizza. In programming, the computer is the oven. It needs raw data (Input), instructions on what to do with it (Process), to produce a result (Output). --- ### 2. Technical Explanation An **IPO Chart** is a design tool used to break down a problem into three distinct components. We use this during the **Design** stage of the Problem Solving Methodology, before we write a single line of code (pseudocode or actual code). It answers three questions: 1. **Input:** What data does the program need from the user or an external file to begin? 2. **Process:** What logical steps, calculations, or decisions must the computer perform on that input? _Tip:_ These steps usually start with verbs (e.g., _Calculate_, _Sort_, _Validate_, _Search_). 3. **Output:** What is the final result displayed to the user or saved to a file? --- ### 3. Concrete Example: Ticket Price Calculator **Scenario:** A program needs to calculate the total cost of concert tickets. Tickets are $50 each. If a user buys more than 10 tickets, they get a 10% discount. |**Input (Data In)**|**Process (The Logic)**|**Output (Information Out)**| |---|---|---| |`quantity_tickets`|1. **Get** `quantity_tickets` from user.<br><br> <br><br>2. **Check** if `quantity_tickets` > 10.<br><br> <br><br>3. **Calculate** basic cost (`quantity` * 50).<br><br> <br><br>4. **If** discount applies, **subtract** 10% from basic cost.<br><br> <br><br>5. **Store** result in `final_price`.|Display "The total cost is: " `final_price`| --- ### 4. Common Pitfalls Checklist - **The "User" Error:** Did you put "User types in name" in the _Process_ column? - _Correction:_ "User types" is the action of _Input_. The Process is simply "Get input" or "Read variable." - **The "Magic Number" Error:** Did you calculate a result in the _Output_ column? - _Correction:_ Outputs should only display data. All calculations must happen in the _Process_ column. - **Variable Names:** Are you using vague words like "the number" or specific variable names like `studentScore`? (Encourage specific variable names). --- ### Fill in the Blanks _A quick formative assessment to check understanding._ **Task:** Complete the IPO chart for a program that calculates the area of a rectangle. |**Input**|**Process**|**Output**| |---|---|---| |`length`|1. Get `length` and `width`.|Display `area`| |`?`|2. Calculate `area` = `?` * `?`|| **Teacher Key (Answers):** - Input: `width` - Process: `length` * `width`