👨‍💻
Software Engineering
Tidy First?: A Personal Exercise in Empirical Software Design
Tidy First?: A Personal Exercise in Empirical Software Design
  • Tidy First?
  • Foreword
  • Preface
  • Part 1: Tidyings
    • 1: Guard Clauses
    • 2: Dead Code
    • 3: Normalize Symmetries
    • 4: New Interface, Old Implementation
    • 5: Reading Order
    • 6: Cohesion Order
    • 7: Move Declaration & Initialization Together
    • 8: Explaining Variables
    • 9: Explaining Constants
    • 10: Explicit Parameters
    • 11: Chunk Statements
    • 12: Extract Helper
    • 13: One Pile
    • 14: Explaining Comments
    • 15: Delete Redundant Comments
  • Part 2: Managing
    • Coming soon
  • Part 3: Theory
    • Coming soon
Powered by GitBook
On this page
  1. Part 1: Tidyings

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.

Previous2: Dead CodeNext4: New Interface, Old Implementation

Last updated 22 days ago