Activity 01
Pair Programming: Refactor Sorting Patterns
Provide pairs with code containing repeated bubble sort logic across arrays. Have them identify the pattern, extract it into a reusable function with parameters, then test on new datasets. Pairs swap functions to integrate and debug.
How would you break this problem into steps that can be reused in different contexts?
Facilitation TipDuring Pair Programming: Refactor Sorting Patterns, circulate to ensure both partners are actively discussing trade-offs between different sorting implementations before deciding on the refactor.
What to look forPresent students with two different code snippets that perform a similar task, for example, calculating the sum of numbers in a list. Ask them to identify the common logical pattern and write a single reusable function that could replace the duplicated code in both snippets.