Activity 01
Pair Refactor: Messy Method Challenge
Provide pairs with a long, duplicated function handling student grades. Partners identify issues like poor naming and redundancy, then refactor into smaller methods over 10 minutes. Pairs test outputs match originals and share one key change with the class.
Analyze the characteristics of 'bad code' and how refactoring addresses them.
Facilitation TipDuring Personal Project Polish, remind students to commit their original messy version before refactoring so they can compare changes later.
What to look forPresent students with a short code snippet exhibiting a common code smell (e.g., duplicated code). Ask them to identify the smell and write one sentence explaining why it is problematic. Collect responses to gauge understanding.