3 ms·
A reviewer can usually tell which code is easier to understand side by side, even when it's yourself as the reviewer. Applying rules like these to your code ma
by mkoubaa 4y ago
A reviewer can usually tell which code is easier to understand side by side, even when it's yourself as the reviewer.
Applying rules like these to your code may or may not result to cleaner code, but that's a testable hypothesis.
I've seen all too often some clean code recommendation or other applied to code and it gets harder to understand. And the person doing the refactoring (often myself) gets caught in sunk cost.
Now my recommendation is always:
1. Use your intuition to predict if a change makes code cleaner.
2. Try to make that change, and be open to doing things a little differently that you first imagined.
3. Test your hypothesis to see what others think. Decide what to do, but be mentally willing to throw it away.
4. Repeat
Articles like this are good resources to help train your intuition, but there is no substitute to developing your personal and team "flavor profile" for what styles suit your way of thinking.