3: Normalize Symmetries
As code grows organically, the same problem may be solved differently at different times and by different people. That's normal/ok, but it makes code more difficult to read.
As a reader, we want consistency. Patterns provide confidence that we know what's going on. Things get confusing when two or more patterns are used interchangeably. As a reader, you expect that difference means difference. Difference can obscure the fact that the same thing is going on.
Pick a way. Convert one of the variants into that way. Tidy one form of unnecessary variation at a time.
Look for routines that are similar but not identical. Separate the different parts from the identical parts.
Last updated