Lesson 1: Software Engineering Process Diagnostic

From Problem Analysis to Working Code

⏱️ 90 minutes 🐍 Python 🎯 Diagnostic Session

📋 Session Overview

Welcome to your first diagnostic session! This isn't a traditional lesson where we teach new concepts. Instead, we'll work through a problem together to see how you approach the complete software engineering process.

What we'll assess:

  • How you analyze and understand problems
  • Your approach to designing solutions before coding
  • How you translate designs into working code
  • Your testing and debugging methodology

This is a collaborative session - we'll work through each phase together. There are no wrong answers; the goal is to understand your current skill level and identify areas where we can help you grow.

💡 The Software Engineering Process

Professional developers don't jump straight into coding. They follow a process:

Requirements → Design → Implementation → Testing → Deployment

Today, we'll focus on the first four stages using a single, focused challenge.

🎯 Today's Challenge: Grade Calculator

🚀 Your Mission

Build a Python function that calculates a student's final grade based on their performance across different assessment types.

We'll work through this together in four phases, mirroring how professional developers approach problems in the real world.

Problem Statement

Create a Python function called calculate_final_grade() that determines a student's letter grade.

Inputs:

  • test_scores - A list of test scores (numbers), worth 50% of final grade
  • assignment_scores - A list of assignment scores (numbers), worth 30% of final grade
  • participation - A single participation score (0-100), worth 20% of final grade

Output:

  • A letter grade: A, B, C, D, or F

Grading Scale:

  • A: 90-100
  • B: 80-89
  • C: 70-79
  • D: 60-69
  • F: Below 60

Phase 1 Understanding the Problem 5-10 min

Before Writing Code: Analyze the Requirements

The first step in software engineering is making sure you fully understand what you're building. Let's break down this problem together.

Questions to Consider:

  • What exactly are the inputs? What data types? What format?
  • What is the expected output? How should it be formatted?
  • What are the calculation rules? (weighted averages, grade boundaries)
  • What edge cases might we encounter?
    • Empty test or assignment lists?
    • Invalid participation scores (negative, over 100)?
    • What if a student has no tests yet?
  • What assumptions are we making?

📝 Your Task: Requirements Analysis

On paper or in your notes: Write down your understanding of the problem. List inputs, outputs, rules, and edge cases you identify.

Phase 2 Design the Solution 10-15 min

Plan Before You Code

Now that we understand the problem, let's design a solution. Professional developers create a blueprint before implementation.

Design Tasks:

  1. Flowchart: Draw a flowchart showing the logic flow (see reference below)
  2. Pseudocode: Write step-by-step pseudocode for the algorithm
  3. Data Structures: What variables do you need? What are their types?
  4. Function Structure: What helper functions might you need?

Flowchart Symbol Reference

Oval
Start/End
Rectangle
Process/Action
Diamond
Decision
Parallelogram
Input/Output
Arrow
Flow Direction

📝 Your Task: Design

On paper: Draw your flowchart using the symbols above. Then write your pseudocode algorithm step-by-step.

Example Pseudocode Structure:

PSEUDOCODE EXAMPLE
START
    INPUT test_scores, assignment_scores, participation

    CALCULATE test_average from test_scores
    CALCULATE assignment_average from assignment_scores

    CALCULATE final_grade = (test_avg * 0.5) + (assignment_avg * 0.3) + (participation * 0.2)

    IF final_grade >= 90 THEN
        RETURN "A"
    ELSE IF final_grade >= 80 THEN
        RETURN "B"
    ...

END

Phase 3 Implement the Code 15-20 min

Transform Design into Working Code

Now it's time to write the actual Python function based on your design. Focus on:

  • Code structure: Clean, readable organization
  • Naming conventions: Clear, descriptive variable and function names
  • Comments: Explain complex logic (but don't over-comment)
  • Error handling: Handle edge cases appropriately

💻 Your Task: Implementation

In your IDE or code editor: Write the complete Python function based on your design. Make sure to implement error handling for edge cases.

💡 Implementation Tips:

  • Start with the basic functionality, then add error handling
  • Test as you go - don't wait until the end
  • Use meaningful variable names (not just x, y, z)
  • Think about: What happens if lists are empty? What if participation > 100?

Phase 4 Test & Debug 5-10 min

Part A: Testing Strategy

Professional developers always test their code. What test cases would you write to verify your function works correctly?

Test Case Categories:

  • Normal cases: Typical input that should work
  • Edge cases: Boundary values (exactly 90 for an A, etc.)
  • Invalid input: Empty lists, negative numbers, etc.

📝 Your Task: Test Cases

On paper or in your notes: Write 3-5 test cases you would use to verify your function. Include the inputs and expected outputs for each test.

Part B: Debug Challenge

Below is a buggy implementation of a similar function. Can you identify the bugs and explain what's wrong?

BUGGY CODE - Find the Issues
def calculate_final_grade(test_scores, assignment_scores, participation):
    # Calculate weighted average
    test_avg = sum(test_scores) / len(test_scores)
    assignment_avg = sum(assignment_scores) / len(assignment_scores)

    final_grade = test_avg * 0.5 + assignment_avg * 0.3 + participation * 0.2

    # Determine letter grade
    if final_grade > 90:
        return "A"
    elif final_grade > 80:
        return "B"
    elif final_grade > 70:
        return "C"
    elif final_grade > 60:
        return "D"
    else:
        return "F"

📝 Your Task: Bug Analysis

On paper or verbally: List each bug you found and explain what's wrong and how to fix it.

💡 Hint: Consider what happens with:

  • Empty test or assignment lists
  • A score of exactly 90 or 80
  • Invalid participation scores (negative or over 100)
  • Type errors (strings instead of numbers)

💭 Reflection

Self-Assessment Questions

Take a moment to reflect on this session:

  • Which phase was most challenging for you? (Understanding, Design, Implementation, Testing)
  • Which phase did you feel most confident about?
  • What did you learn about your problem-solving approach?
  • What aspects of software engineering would you like to improve?
  • Did designing before coding help, or did you find it slowed you down?

What's Next?

Based on how you approached this challenge, we'll tailor future lessons to strengthen specific areas of the software engineering process. This diagnostic helps us understand where you're already strong and where focused practice will have the most impact.

← Back to Blake's Learning Hub