You are given a forty-line function that works. It reads a list of records, filters them, computes two totals and prints a summary.
- Run it. Record the exact output for the supplied input — this is your comparator, and you will check against it after every change.
- Find the three decisions buried in it. Give each a name.
- Extract each into its own function, one at a time. Re-run after each extraction and compare with your recorded output.
- When you are done, the original function should be about eight lines and should read like a description of what it does.
Do not change behaviour and structure in the same step. If the output changes after an extraction, the extraction is wrong — revert it and try again rather than adjusting the comparator.
That discipline is the whole studio. It is also the discipline behind every piece of assessment in this course.