- avoided magic numbers by using Macros which was good
- defined the Macros in multiple places which was bad
Tracing the Root Cause
To understand why this duplication happened, I started asking myself a series of "why" questions:Why was the macro duplicated?
Because the original location of the definition was poorly chosen, and later developers were reluctant to move it.
Why were they reluctant to move it?
Because moving a definition requires deleting it from its original location.
Why the hesitation to delete code?
Several possible reasons:
- They didn’t have proper source control.
- Their source control system didn’t clean up deleted files from the workspace.
- They lacked sufficient test coverage to feel confident in making changes.
Why This Matters
Code definitions and implementations need to be free to move between modules and libraries as a system evolves. If they aren't, you’ll eventually end up with duplicated logic, circular dependencies — or both.In short, good architecture requires not just clean code, but also the courage and tooling to move and delete it when necessary.
No comments:
Post a Comment