---
What if we rearranged the code to be by subject rather than by step?
Subject vs Step. This is an excellent refactoring trick that I have never had words to describe before.
Also, I find I write my first crack at code like the first sample, since this is how it is often described in business requirements. Sometimes (often?) you don't see the repetition until you've typed it out.
I'm sure my code repositories are littered with two check-ins back-to-back; the first is a literal translation of some business requirement (or mimicking of a manual process), and the second a re-factoring of the code.

