Lesson 1: Introduction to Software Development & Algorithms

Building Your Foundation in Software Engineering

⏱️ 60 minutes 🐍 Python 📚 Year 11 - Programming Fundamentals
📋

What You'll Learn Today

Welcome to your first lesson in Software Engineering! Today we're going to explore the foundations of how software is created. By the end of this lesson, you'll understand:

  • What software development actually involves
  • How programmers think about solving problems (computational thinking)
  • The basic building blocks of all algorithms
  • How to write your first simple algorithm in pseudocode and Python
1

What is Software Development?

You use software every single day - Instagram, Spotify, Google Maps, even the calculator on your phone. But have you ever wondered how these apps are created?

Software development is the process of creating these programs. It's not just typing code - it's a structured process with clear steps.

The Software Development Lifecycle (SDLC)

Think about building a house. You don't just start putting up walls randomly. You:

  1. Figure out what kind of house you need
  2. Draw up plans (blueprints)
  3. Build the house following those plans
  4. Test everything (plumbing, electricity, etc.)
  5. Move in and maintain it over time

Software development follows a similar process!

Stage What Happens Real Example
Requirements Figure out what the software needs to do "We need an app that lets students track their homework"
Design Plan how it will work before coding "It needs a login page, a dashboard, and a calendar view"
Development Actually write the code Programmers write Python, JavaScript, etc.
Testing Check if everything works correctly "Does the app crash? Can users log in? Do dates save properly?"
Deployment Release it to users Upload to the App Store or make it available online
Maintenance Fix bugs and add new features Release updates, fix crashes, add dark mode
Key Takeaway

Software development is a structured process, not random coding. Every app you use went through these stages!

2

Computational Thinking - How Programmers Solve Problems

Before you can write code, you need to think like a programmer. This is called computational thinking - it's a way of breaking down problems so a computer can solve them.

Let's learn the four main skills:

1. Decomposition (Breaking Problems Apart)

🍕 Example: Ordering Pizza Online

A pizza ordering app seems complex, but we can break it into smaller parts:

  • Choose pizza size
  • Select toppings
  • Add to cart
  • Enter delivery address
  • Process payment
  • Track delivery

Each of these is a smaller, manageable problem that's easier to solve!

2. Pattern Recognition (Finding Similarities)

🔁 Example: Login Systems

Whether you're logging into Instagram, Gmail, or Netflix, the pattern is always similar:

  • Enter username/email
  • Enter password
  • Click login button
  • Check if credentials are correct
  • Either grant access or show error

Once you solve it once, you can reuse this pattern!

3. Abstraction (Focusing on What Matters)

Abstraction means ignoring unnecessary details and focusing on what's important.

Example: When you use Google Maps, you just see "Turn left in 200m." You don't need to know how GPS satellites work, how the routing algorithm calculates the path, or how the map data is stored. Those details are abstracted away.

4. Algorithm Design (Step-by-Step Instructions)

An algorithm is simply a set of step-by-step instructions to solve a problem. You use algorithms in everyday life!

☕ Example: Making Coffee

Algorithm for making instant coffee:

  1. Boil water in kettle
  2. Put coffee powder in cup
  3. Add sugar (if desired)
  4. Pour hot water into cup
  5. Stir well
  6. Add milk (if desired)
  7. Stir again

This is an algorithm! Clear, step-by-step, and anyone can follow it.

Key Takeaway

Computational thinking helps you break down complex problems into simple, solvable steps. Every programmer uses these skills daily!

3

The Three Building Blocks of Every Algorithm

Every algorithm - from simple calculators to complex AI - is built using just three fundamental structures:

1. Sequence (Do Things in Order)

Instructions happen one after another, in a specific order.

📝 Pseudocode Example: Getting Ready for School
PSEUDOCODE
START
    Wake up
    Get out of bed
    Brush teeth
    Get dressed
    Eat breakfast
    Pack bag
    Leave house
END

Notice: Order matters! You wouldn't eat breakfast before getting out of bed, right?

🐍 Python Example: Simple Sequence
PYTHON
# A simple program that greets a user
print("Welcome to my program!")
name = input("What is your name? ")
print("Hello, " + name + "!")
print("Nice to meet you.")

Explanation:

  • Line 2: Display a welcome message
  • Line 3: Ask for the user's name and store it
  • Line 4: Print a personalized greeting
  • Line 5: Print a final message

Each line runs in order, one after another.

2. Selection (Make Decisions)

Sometimes we need to make choices based on conditions. This is called selection or branching.

In everyday language: "IF something is true, THEN do this, ELSE do that"

📝 Pseudocode Example: Checking the Weather
PSEUDOCODE
START
    Check weather forecast
    IF it's raining THEN
        Take umbrella
    ELSE
        Leave umbrella at home
    END IF
    Leave house
END
🐍 Python Example: Age Checker
PYTHON
# Check if someone can vote
age = int(input("How old are you? "))

if age >= 18:
    print("You can vote!")
else:
    print("You're too young to vote.")
    years_until = 18 - age
    print("You can vote in " + str(years_until) + " years.")

Explanation:

  • The program asks for age
  • if age >= 18: checks if age is 18 or more
  • If TRUE: prints "You can vote!"
  • If FALSE: runs the else block instead

3. Iteration (Repeat Actions)

Iteration means repeating actions. Also called loops.

Instead of writing the same instruction 100 times, we just say "do this 100 times"!

📝 Pseudocode Example: Washing Dishes
PSEUDOCODE
START
    WHILE there are dirty dishes DO
        Pick up one dish
        Wash the dish
        Dry the dish
        Put it away
    END WHILE
    Clean the sink
END

The actions inside the WHILE loop repeat until all dishes are clean.

🐍 Python Example: Counting
PYTHON
# Print numbers from 1 to 5
for number in range(1, 6):
    print("Count: " + str(number))

print("Done counting!")
OUTPUT
Count: 1
Count: 2
Count: 3
Count: 4
Count: 5
Done counting!

Explanation:

  • for number in range(1, 6): creates a loop
  • The loop runs 5 times (1, 2, 3, 4, 5)
  • Each time, it prints the current number
  • After the loop finishes, it prints "Done counting!"
The Three Building Blocks
  • Sequence: Do steps in order
  • Selection: Make decisions (IF/ELSE)
  • Iteration: Repeat actions (loops)

Every program you'll ever write uses these three structures. Master them, and you can build anything!

4

Let's Design Your First Algorithm!

Now it's time to put everything together. We're going to design a simple algorithm that uses all three building blocks.

Problem: Number Guessing Game

Requirements: Create a program where the computer picks a secret number between 1 and 10, and the user has to guess it. The program should tell them if they're too high, too low, or correct.

Step 1: Design in Pseudocode

📝 Algorithm Design
PSEUDOCODE
START
    Generate random number between 1 and 10
    Store it as 'secret_number'

    Display "Guess a number between 1 and 10"
    Get user's guess

    IF guess equals secret_number THEN
        Display "Correct! You won!"
    ELSE IF guess is less than secret_number THEN
        Display "Too low! Try again."
    ELSE
        Display "Too high! Try again."
    END IF
END

Notice how we use:

  • Sequence: Steps happen in order
  • Selection: IF/ELSE to make decisions

Step 2: Convert to Python Code

🐍 Python Implementation
PYTHON
import random

# Generate secret number
secret_number = random.randint(1, 10)

# Get user's guess
print("Guess a number between 1 and 10:")
guess = int(input())

# Check if correct
if guess == secret_number:
    print("Correct! You won!")
elif guess < secret_number:
    print("Too low! Try again.")
else:
    print("Too high! Try again.")

Line-by-line explanation:

  • Line 1: Import the random module (gives us random numbers)
  • Line 4: Generate a random number from 1-10
  • Line 7-8: Ask user for input and convert to integer
  • Line 11-16: Check the guess and give feedback

Step 3: Enhanced Version with Loops

The current version only lets the user guess once. Let's add iteration so they can keep guessing until they win!

🐍 Enhanced Version
PYTHON
import random

# Generate secret number
secret_number = random.randint(1, 10)
guesses = 0

print("I'm thinking of a number between 1 and 10.")
print("Can you guess it?")

# Keep looping until they get it right
while True:
    guess = int(input("Your guess: "))
    guesses = guesses + 1

    if guess == secret_number:
        print("Correct! You won!")
        print("It took you " + str(guesses) + " guesses.")
        break  # Exit the loop
    elif guess < secret_number:
        print("Too low! Try again.")
    else:
        print("Too high! Try again.")

New concepts:

  • while True: Creates a loop that runs forever (until we break out)
  • guesses = guesses + 1: Counts how many attempts
  • break: Exits the loop when they guess correctly
Congratulations!

You've just designed a complete program using all three algorithmic building blocks:

  • ✓ Sequence: Steps run in order
  • ✓ Selection: IF/ELIF/ELSE for decisions
  • ✓ Iteration: WHILE loop for repetition
💪

Practice Exercise

🎯 Your Turn: Simple Calculator

Challenge: Design a calculator program that:

  1. Asks the user for two numbers
  2. Asks what operation they want (+, -, *, /)
  3. Performs the calculation
  4. Displays the result

Step 1: Write it in pseudocode first (on paper or in a text file)

Step 2: Convert it to Python code

Step 3: Test it with different numbers

Bonus Challenge: Add a loop so the user can do multiple calculations without restarting the program!

💡 Hints
  • Use input() to get user input
  • Use int() or float() to convert strings to numbers
  • Use if/elif/else to check which operation to perform
  • Remember: + adds, - subtracts, * multiplies, / divides
🎓

Quick Knowledge Check

Test Your Understanding
Question 1: What are the six stages of the Software Development Lifecycle?
Try to recall them before checking:
  1. Requirements
  2. Design
  3. Development
  4. Testing
  5. Deployment
  6. Maintenance
Question 2: What are the three fundamental building blocks of algorithms?
Answer:
  • Sequence - doing things in order
  • Selection - making decisions (IF/ELSE)
  • Iteration - repeating actions (loops)
Question 3: Which building block would you use if you wanted to print "Hello" 10 times?
Answer:

Iteration (a loop) - because we're repeating the same action multiple times.

Question 4: What is computational thinking?
Answer:

A way of solving problems by breaking them down into smaller parts (decomposition), finding patterns, focusing on important details (abstraction), and creating step-by-step solutions (algorithms).

📋

Lesson Summary

What We Covered Today

1. Software Development Lifecycle:

  • Requirements → Design → Development → Testing → Deployment → Maintenance
  • Software creation is a structured process, not random coding

2. Computational Thinking:

  • Decomposition: Break problems into smaller parts
  • Pattern Recognition: Find similarities to reuse solutions
  • Abstraction: Focus on what matters, ignore unnecessary details
  • Algorithm Design: Create step-by-step solutions

3. Three Building Blocks of Algorithms:

  • Sequence: Instructions in order
  • Selection: Decisions (IF/ELSE)
  • Iteration: Loops (WHILE/FOR)

4. Practical Skills:

  • Writing pseudocode
  • Converting pseudocode to Python
  • Building a complete program (number guessing game)
📚

Homework & Next Steps

Before Next Lesson
  1. Complete the Calculator Exercise above if you haven't already
  2. Experiment: Modify the number guessing game to:
    • Use a range of 1-100 instead of 1-10
    • Give the user only 5 attempts
    • Show a "Game Over" message if they run out of attempts
  3. Think of a real-world problem you could solve with a program. Try writing the algorithm in pseudocode.

Next Lesson Preview: We'll dive deeper into data types, variables, and more complex algorithms. We'll also explore flowcharts and structure charts!

← Back to Ulrich's Home