Module 1.7 Software Develop e t Ca bridge Lower Seco dary Co puti g 3 Grade 8 Based on book by Victoria Ellis & Sarah Lawrey Teacher: Aditya Shirke Lear i g Objective Deco po itio Algorit A aly i Te ti g Understand what decomposition is and Learn to predict algorithm outcomes Create test plans using different types why it's used in programming and test predictions of data Learn how to decompose problems into Understand iterative development in Understand why various data types are sub-problems programming needed for testing By the end of this module, you'll understand key software development concepts and practices used by professional programmers. W at i Deco po itio ? Definition: Breaking down large problems into smaller, manageable parts Sub-problems: Small problems that combine to solve a larger overall problem Key Point: It's easier to solve many small sub-problems than one large problem Analogy: Like decomposing organic material into compost breaking down into smaller parts Decomposition is a fundamental concept in computing that helps us tackle complex problems by dividing them into simpler components. No -Progra i g Exa ple: I truder Alar Sy te Problem: Design an intruder alarm system Set Alar C eck for I truder Tur Alar Configure the system to detect Monitor sensors to detect any Disable the alarm when authorized access unauthorized entry unauthorized presence is confirmed Note: Sub-problems can be broken down into steps, but steps cannot be broken down further. Off No -Progra Sc ool i g Exa ple: Getti g Ready for Problem: Help Sofia remember her morning routine 1 Getti g Up Wake up when alarm rings, get out of bed 2 Getti g Wa ed Brush teeth, wash face, shower 3 Getti g Dre ed Put on school uniform or appropriate clothes 4 Havi g Breakfa t Eat a nutritious meal to start the day 5 Packi g Bag Gather books, homework, and supplies Key Feature: Sub-problems are independent and reusable Progra i g Exa ple: S ake a d Ladder Ga e Problem: Create a computer game of snakes and ladders Deco po itio Exa ple 1: 01 02 03 Loading and starting a new game Player making a move Moving the piece 04 05 Checking if on snake/ladder and moving Checking if player has won Alter ative Deco po itio : Sa e Proble , Differe t Approac Deco po itio Exa ple 2: 01 02 Select number of players Set players in first position 03 04 Display board Roll number block 05 06 Move player Check if they have won Key Insight: Multiple valid ways to decompose the same problem. There is no single "correct" way to break down a problem - different approaches can all lead to successful solutions. W y Do We Deco po e Proble ? Hu a Nature Tea Collaboratio Specializatio Breaking large tasks into smaller ones Multiple programmers can work on Different programmers can focus on is more natural for our brains to different sub-problems their expertise areas process simultaneously Efficie cy Reu ability Faster development when work is Sub-routines can be reused multiple divided times W at i Iterative Develop e t? Definition: Writing programs in stages, testing each part before moving to the next Process: Write Repeat ³ Test ³ Change/Fix ³ Write Next Part ³ Test ³ Key Principle: Don't write all code first and then test everything at once Benefit: Easier to find and fix problems in smaller code sections Iterative development is like building a house brick by brick, checking each layer is solid before adding the next, rather than building the whole house and then checking if it's stable. Iterative Develop e t Proce Exa ple: Fire, Water, Eart ga e ³ Test Step 2: Write code for first player choice ³ Test Step 1: Write code for player names input Step 3: Continue building and testing each part Advantage: Problems are caught early and are easier to fix Predicti g Outco e Definition: Guessing what will happen when a program runs Process: 1. Read the algorithm carefully 2. Think about expected outputs with specific inputs 3. Run the program to check if prediction was correct Focus: Get an overview of the program, not every detail Goal: Identify what the outcomes will be (outputs or data changes) Type of Te t Data Nor al Te t Data I valid Te t Data Bou dary Te t Data Data that is accepted or within bounds Data that is not accepted or outside Data on the edge of what is/isn't allowed bounds Example for age Example for age f16: 10, 12, 15 Example for age f16: 17, 20, 25 Why All Types? Ensures program works correctly in all situations, not just the expected ones. f16: 16, 17 Te t Pla Creatio Purpose: Systematic approach to testing programs Test data type Description Example inputs Expected output Actual result Normal Within acceptable 12 "Welcome to the club!" To be filled 20 "Sorry, you're too old" To be filled 16 "Welcome to the club!" To be filled range Invalid Outside acceptable range Boundary At the edge of acceptance Steps: Create table ³ Add normal data ³ Add invalid data ³ Add boundary data Exa ple: Te ti g Age Progra Program Rule: Club allows children 16 or younger to join Boundary Testing Reveals: Original Code Condition: if (age < 16) A 16-year-old should be Problem Found: Original condition original code would reject excludes 16-year-olds allowed to join, but the them! Solution: Change to if (age <= 16) Lesson: Boundary testing reveals edge case errors Key Point: Test with range of data, not just one or two values Su ary Key Takeaway Deco po itio Iterative Develop e t Break large problems into Write and test code in small stages manageable sub-problems Multiple valid approaches to Fix problems early before they compound decomposition exist Predictio Te ti g Think through program logic before running Use normal, invalid, and boundary test data Real-World Application: These practices are essential in professional software development and will help you create more reliable, efficient programs.