Activity 01
Pair Refactoring Challenge: Monolith to Modules
Provide pairs with a 50-line monolithic program that calculates statistics from a dataset. Instruct them to identify repeated code blocks, convert them into functions and procedures, then test for identical outputs. Pairs share one improvement with the class.
Analyze how modularization reduces the complexity of debugging a large system.
Facilitation TipBefore starting the Pair Refactoring Challenge, have students highlight repeated code blocks in different colors to visually identify logical units.
What to look forPresent students with a short, monolithic code snippet that performs multiple tasks. Ask them to identify at least two distinct logical blocks within the code and explain how each could be refactored into a separate function or procedure, stating what each new module would be responsible for.