15  Teaching and Learning

The advent of AI coding assistants has dramatically changed not just how we program, but also how we teach and learn programming. This chapter explores the application of intentional prompting principles in educational settings, offering guidance for both educators and students.

15.1 Pedagogical Applications of Intentional Prompting

15.1.1 Rethinking Programming Education

Traditional programming education has focused on teaching syntax, algorithms, and problem-solving techniques directly. With AI assistants readily available, the educational focus needs to shift:

Traditional Focus Intentional Prompting Focus
Syntax memorization Critical evaluation of AI-generated code
Writing code from scratch Guiding AI toward better solutions
Debugging syntax errors Understanding conceptual errors
Implementing standard algorithms Adapting algorithms to specific contexts
Following prescribed solutions Exploring multiple approaches

This shift doesn’t mean abandoning the fundamentals—rather, it means teaching them in a new context where AI collaboration is assumed.

15.1.2 The Educator’s Role in the AI Era

Educators now have additional responsibilities:

  1. Teaching effective prompting alongside programming concepts
  2. Modeling critical evaluation of AI-generated solutions
  3. Emphasizing conceptual understanding over implementation details
  4. Preparing students for a future where AI collaboration is the norm
  5. Creating assessment methods that work in an AI-assisted environment

15.1.3 Integrating AI into Curriculum Design

AI assistants can be integrated at different levels of the curriculum:

Level 1: AI as a Learning Resource - Students use AI to explain concepts they don’t understand - AI provides additional examples and alternative explanations - Educators guide students on effective question-asking

Level 2: AI as a Programming Partner - Students learn to prompt AI for code suggestions - Assignments include evaluating and improving AI-generated code - Focus on understanding the “why” behind AI suggestions

Level 3: AI as a Feedback Mechanism - Students request AI feedback on their code - AI identifies potential improvements and best practices - Students learn to critically evaluate AI feedback

Level 4: AI as a Challenge Mechanism - Students intentionally guide AI toward errors, then identify them - Assignments include “debugging” AI-generated code - Focus on developing critical thinking skills

15.2 Designing Assignments in the AI Era

15.2.1 Beyond “AI-Proof” Assignments

Many educators initially responded to AI coding assistants by trying to create “AI-proof” assignments—ones that AI tools couldn’t easily solve. This approach is ultimately unsustainable and misses the opportunity to teach intentional prompting skills.

Instead, design assignments that incorporate AI collaboration explicitly:

15.2.2 Prompting-Focused Assignments

These assignments emphasize the skill of effective prompting:

Example assignment:

Topic: Sorting Algorithms

Your task is to implement a merge sort algorithm in Python. Instead of
coding it directly, you'll guide an AI assistant through the implementation
process.

Requirements:
1. Start with a broad prompt asking the AI to implement merge sort
2. Evaluate the initial implementation, identifying at least three aspects to improve
3. Use targeted prompts to refine the implementation
4. Document each prompt you used and the AI's response
5. Submit your final code along with your prompting journey and reflections

15.2.3 Step-by-Step Guided Exercise

This example from an educational setting shows how to guide students through intentional prompting:

Example: Building a Python Gradebook

Task: Create a gradebook program that: - Uses a dictionary to store student names and their list of scores - Has a function to calculate average score - Prints each student’s name and average - Handles edge cases (e.g., empty lists, invalid inputs)

Step 1: Start Simple

"Can you help me write a Python program to store student names and their test scores, and print their average?"

The AI might provide a basic implementation:

students = {
    "Alice": [85, 90, 78],
    "Bob": [70, 88, 92],
    "Charlie": [100, 100, 90]
}

for name, scores in students.items():
    avg = sum(scores) / len(scores)
    print(f"{name} has an average of {avg}")

Step 2: Add a Function

"Can you turn the average calculation into a function?"

The AI improves the implementation:

def average(scores):
    return sum(scores) / len(scores)

for name, scores in students.items():
    print(f"{name} has an average of {average(scores)}")

Step 3: Improve Robustness

"What happens if a student has no scores? Can you fix that?"

The AI addresses the edge case:

def average(scores):
    if not scores:
        return 0
    return sum(scores) / len(scores)

This guided approach teaches students to: - Start with a simple prompt - Identify limitations in the initial response - Use targeted follow-up prompts to improve specific aspects - Think critically about edge cases - Guide the AI through a step-by-step improvement process

15.2.4 Evaluation and Improvement Assignments

These assignments focus on critical evaluation of AI-generated code:

Example assignment:

Topic: Error Handling

You are provided with an AI-generated function that processes user
input for a banking application. The code is functional but has
issues with error handling, security, and readability.

Requirements:
1. Evaluate the provided code, identifying all potential issues
2. Create a prioritized list of improvements needed
3. Implement the improvements
4. Document your reasoning for each change
5. Reflect on what the AI should have done differently

15.2.5 Comparative Analysis Assignments

These assignments emphasize exploring multiple approaches:

Example assignment:

Topic: Data Structures

Use an AI assistant to implement three different data structures for
storing and retrieving student records: a hash table, a binary search
tree, and a balanced tree.

Requirements:
1. Guide the AI to implement each data structure
2. Create a test suite to measure performance characteristics
3. Analyze the strengths and weaknesses of each approach
4. Select the most appropriate structure for the given requirements
5. Justify your selection with empirical evidence

15.2.6 Process Documentation Assignments

These assignments focus on the development process rather than just the final code:

Example assignment:

Topic: API Development

Create a RESTful API for a library management system, documenting your
entire development process.

Requirements:
1. Document your initial planning (endpoints, data models)
2. Record all prompts used with AI assistants
3. Document key decisions and pivots during development
4. Include a reflective analysis of where AI was most/least helpful
5. Identify areas where your human expertise was essential

15.3 Assessing Understanding vs. Output

15.3.1 Moving Beyond Code Assessment

In the AI era, the code students produce is no longer a reliable indicator of their understanding. Assessment strategies must evolve:

15.3.2 Process-Based Assessment

Evaluate the student’s development process rather than just the final code:

  • Documentation of prompting strategy
  • Reflection on AI collaboration
  • Analysis of alternative approaches considered
  • Justification of design decisions

15.3.3 Concept Demonstration

Have students demonstrate conceptual understanding separate from code production:

  • Verbal explanations of how their code works
  • Identification of potential edge cases
  • Analysis of time and space complexity
  • Prediction of how code would behave under different inputs

15.3.4 Code Modification Challenges

Test understanding through targeted modification tasks:

  • Adding a new feature to existing code
  • Optimizing for a different constraint
  • Adapting the solution to a different context
  • Fixing intentionally introduced bugs

15.3.5 Prompt Engineering Assessment

Directly assess students’ ability to effectively prompt AI tools:

  • Provide a difficult problem and evaluate prompting strategy
  • Grade the quality and specificity of prompts
  • Assess ability to refine prompts based on initial responses
  • Evaluate critical thinking about AI-generated solutions

15.4 Building a Learning Community

15.4.1 Collaborative Learning in the AI Era

AI assistants change the dynamics of collaborative learning:

Challenges: - Students may rely on AI rather than peers for help - Individual work becomes harder to distinguish - Knowledge gaps can be masked by AI assistance

Opportunities: - Groups can focus on higher-level design discussions - AI can serve as a common “baseline” for group projects - Students can learn from each other’s prompting strategies

15.4.2 Peer Learning Strategies

Encourage intentional peer collaboration:

  1. Prompt-sharing sessions where students compare effective prompts
  2. Code review workshops focused on evaluating AI-generated code
  3. Paired prompting where students collaborate on guiding AI
  4. Prompting competitions to solve challenges with the most effective prompts

15.4.3 Creating a Supportive Environment

Foster an environment that supports learning with AI:

  1. Explicitly acknowledge AI use as expected and valuable
  2. Establish clear guidelines for appropriate AI collaboration
  3. Share success stories of effective AI use
  4. Normalize discussions about AI limitations and frustrations
  5. Recognize prompting expertise as a valuable skill

15.5 Case Studies in Educational Settings

15.5.1 Case Study 1: Introductory Programming Course

Context: An introductory Python programming course at a university, with students who have no prior programming experience.

Approach: The instructor redesigned the course around intentional prompting principles:

  1. Week 1-3: Foundations and AI Introduction
    • Basic Python syntax and concepts taught traditionally
    • Introduction to AI assistants in week 3
    • Assignment: Compare hand-written and AI-generated solutions
  2. Week 4-8: Guided AI Collaboration
    • Structured prompting templates provided
    • Focus on understanding and modifying AI-generated code
    • Assignments include documented prompting journey
  3. Week 9-15: Independent Problem-Solving
    • Complex problems requiring multiple prompting iterations
    • Focus on proper problem decomposition
    • Final project includes reflection on AI collaboration process

Results: - Students showed stronger conceptual understanding compared to previous cohorts - More students attempted advanced topics and extensions - Course completion rate increased by 15% - Students reported higher confidence in their programming abilities

Key Takeaway: Integrating AI assistants from the beginning, with explicit instruction on effective usage, led to better learning outcomes than either banning AI or allowing it without guidance.

15.5.2 Case Study 2: Advanced Software Engineering Course

Context: A senior-level software engineering course focused on designing and implementing a complex system over a semester.

Approach: The instructor implemented a “documentation-first” intentional prompting methodology:

  1. Project Planning Phase
    • Students created detailed specifications before any coding
    • AI was used to evaluate specifications for completeness
    • Students documented initial architectural decisions
  2. Implementation Phase
    • Students used the six-step methodology for each component
    • Weekly submissions included prompting strategies used
    • Peer reviews focused on AI collaboration effectiveness
  3. Integration and Testing Phase
    • AI used to generate comprehensive test cases
    • Students documented where AI testing missed edge cases
    • Final submission included reflective analysis

Results: - Projects showed more consistent architecture and documentation - Student teams reported fewer integration issues - Code quality metrics improved over previous cohorts - Students demonstrated better ability to explain architectural decisions

Key Takeaway: The intentional, documentation-first approach helped students maintain control over increasingly complex projects, even with significant AI assistance.

15.6 Practical Guide for Educators

15.6.1 Introducing Intentional Prompting in Your Curriculum

Step 1: Self-Education - Familiarize yourself with AI coding assistants - Practice the six-step methodology on your own projects - Develop your own prompting skills

Step 2: Curriculum Analysis - Identify which learning objectives remain essential - Determine where AI can enhance rather than replace learning - Design new objectives around intentional prompting

Step 3: Assignment Redesign - Convert existing assignments to incorporate AI collaboration - Create new assignments focused on prompting skills - Develop clear guidelines for acceptable AI use

Step 4: Assessment Adaptation - Design assessments that evaluate process, not just output - Create rubrics that include prompting quality - Implement verification mechanisms (explanations, modifications)

Step 5: Student Onboarding - Explicitly teach effective prompting techniques - Provide examples of good and poor AI collaboration - Set clear expectations for documentation

15.6.2 Sample Lesson Plan: Introduction to Intentional Prompting

Objective: Introduce students to intentional prompting for programming tasks

Materials: - Access to an AI coding assistant - Sample programming problem - Prompting template handout

Lesson Flow:

  1. Introduction (15 min)
    • Discuss the limitations of traditional “solution-oriented” prompting
    • Introduce the concept of intentional prompting
    • Share examples of effective vs. ineffective prompts
  2. Demonstration (20 min)
    • Instructor demonstrates solving a problem using intentional prompting
    • Highlight the iterative refinement process
    • Show how to evaluate and improve AI-generated code
  3. Guided Practice (30 min)
    • Students work in pairs on a simple programming task
    • Using provided prompting templates
    • Instructor circulates to provide feedback
  4. Reflection and Discussion (15 min)
    • Students share what worked and what didn’t
    • Discuss patterns in effective prompts
    • Address common misconceptions
  5. Independent Practice (Homework)
    • Students solve a new problem using intentional prompting
    • Document their prompting journey
    • Reflect on what they learned about effective prompting

15.7 Practical Guide for Students

15.7.1 Maximizing Learning with AI Assistance

Develop an Intentional Learning Mindset - Focus on understanding concepts, not just completing assignments - Use AI to explore alternative approaches, not just get answers - Reflect on what you’re learning through AI interactions

Document Your Learning Journey - Keep a prompting journal recording effective prompts - Note concepts that were unclear and how AI helped clarify them - Track your progress in prompting effectiveness

Balance AI Assistance with Independent Work - Try solving problems independently before consulting AI - Use AI to verify your understanding, not replace it - Deliberately practice skills that AI can’t provide (debugging, testing)

Leverage AI for Learning Acceleration - Use AI to explain concepts in multiple ways - Ask AI to generate practice problems on topics you’re struggling with - Have AI explain the “why” behind its recommendations

15.7.2 Self-Assessment Questions

Students can use these questions to gauge their intentional prompting skills:

  1. Can I explain the code I submitted, including its logic and potential edge cases?
  2. Do I understand why the AI suggested certain approaches over others?
  3. Can I modify the solution to work under different constraints?
  4. Am I able to identify limitations or potential improvements in AI-generated code?
  5. Can I effectively guide AI through complex problems using systematic prompting?

15.8 Key Takeaways

  • The educational focus should shift from syntax to intentional collaboration
  • Assignments should incorporate AI explicitly rather than trying to be “AI-proof”
  • Assessment should focus on process, understanding, and prompting skills
  • Both educators and students need new strategies for effective learning with AI
  • Intentional prompting principles provide a framework for teaching programming in the AI era
  • Building learning communities around AI collaboration enhances educational outcomes

15.9 Moving Forward

In the final chapter, we’ll explore the future of intentional prompting as AI technology continues to evolve, examining emerging trends and preparing for the next evolution of human-AI programming collaboration.