| 📊 View Lecture Slides | Full-screen presentation with navigation |
Session 5: AI-Assisted Software Engineering
| Session Duration: 2 Hours | Block: 2 — AI-Assisted Engineering & Integration |
Learning Objectives
By the end of this session, students will be able to:
- Describe the AI-assisted software development workflow and its key mental models
- Use GitHub Copilot to explain, generate, and debug unfamiliar code
- Apply the “describe → generate → evaluate → refine” cycle for code development
- Identify the limits of AI code generation and where human judgment is irreplaceable
Hour 1: AI as Development Partner (Instructor-Led — 60 minutes)
1.1 The New Mental Model
Traditional software development: you write every line of code from memory or by consulting documentation.
AI-assisted software development: you direct the AI to write code, then evaluate and refine the output. You are the architect and quality controller. The AI handles implementation volume.
This shift has a critical implication: you do not need to know every syntax detail by heart, but you absolutely need to understand what correct code looks like and what it should do. If you cannot evaluate the AI’s output, you cannot responsibly ship it.
1.2 Four Key Copilot Workflows
Workflow 1: Explain Code Select any code block in VS Code. Use Copilot Chat: “Explain what this code does, step by step.” Useful for navigating unfamiliar codebases or understanding library internals.
Workflow 2: Generate Code from Comments Type a natural language comment describing what you want, then start a new line. Copilot will suggest an implementation. Example:
# Parse the JSON response from the AI API and extract the 'content' field
After pressing Tab to accept the suggestion, verify: does it actually do what the comment says?
Workflow 3: Debug with Explanation When an error occurs, paste the error message and the relevant code into Copilot Chat: “I’m getting this error: [error]. Here is the code: [code]. What is causing this and how do I fix it?”
Workflow 4: Write Tests Select a function and ask: “Write three test cases for this function, covering the happy path, an edge case, and an error condition.” This is one of the highest-value uses of AI code generation.
1.3 The Evaluate-Refine Cycle
AI-generated code is a first draft. Always ask:
- Does it run? Syntax errors are easy to spot. Run the code.
- Does it do what I asked? Test with simple inputs you can verify manually.
- Does it handle edge cases? What happens with empty input? With very large input? With unexpected types?
- Is it readable? Will you understand this code in three months?
- Is it secure? Does it trust user input? Does it expose credentials? Does it have injection risks?
1.4 What AI Cannot Replace
AI code generation is powerful but not magic. It reliably fails at:
- Novel architecture decisions: Should this be a microservice or a monolith? AI can list tradeoffs but cannot know your team’s context.
- Business logic validation: Is this the correct calculation for your company’s pricing model? Only you know.
- Security edge cases: AI frequently generates insecure code that looks syntactically correct.
- Integration debugging: When two systems interact unexpectedly, AI often hallucinates the cause.
Your role is to provide the judgment these tasks require.
Hour 2: Practical — Navigate and Extend an Unfamiliar Codebase (60 minutes)
Lab 5.1 — Explore with Copilot
Fork or download the starter codebase provided for this session (a simple Python Flask web application with incomplete routes). Open it in VS Code.
Task 1 — Understand: Select the main application file. Ask Copilot Chat to explain the overall structure. Then ask it to explain each route individually.
Task 2 — Identify Gaps: Ask Copilot: “What functionality is missing from this application based on the existing code structure?”
Lab 5.2 — Generate and Verify
Task 3 — Generate: Using comment-driven generation, add the missing route. Write a comment describing the expected behaviour, then accept Copilot’s suggestion.
Task 4 — Test: Run the application. Test the new route manually by sending requests. Does it behave as expected?
Task 5 — Debug: Intentionally introduce an error. Ask Copilot Chat to diagnose it. Does the diagnosis match the actual cause?
Lab 5.3 — Apply to Your Project
Write the first function of your AI application using Copilot. This should be a utility function — for example, a function that takes a string input and calls your AI API (even if the API key is a placeholder for now).
Apply the evaluate-refine cycle: run it, test it, check the edge cases.
Key Takeaways
- AI-assisted development shifts the engineer from implementation writer to architect and quality controller
- Four core Copilot workflows: explain, generate, debug, write tests
- The evaluate-refine cycle is non-negotiable — never ship unreviewed AI code
- AI reliably fails at novel architecture, business logic validation, security edge cases, and integration debugging
Further Reading
- GitHub Copilot documentation: docs.github.com/copilot
- “The Pragmatic Programmer” — chapter on “Tracer Bullets” (iterative development)
- OWASP Top 10 Web Application Security Risks — essential reading before Session 14


