Amy Blankenship
1 min readJul 28, 2024

--

This entire section is a big nope, but Medium doesn't allow you to highlight multiple paragraphs/bullet points, so I just highlighted the most egregious.

Adding extra parameters just makes the whole function less maintainable and harder to read. If you write your tests *first*, you can confidently refactor, knowing you didn't lose any of the old behavior and the new behavior is covered as well. If things need to be restructured to fix the bug, do it! Chances are you'll never be given a chance to go back and refactor, and leaving crap that you could clean up just builds mountains of technical debt.

Note, don't refactor if that's your method of *finding* the bug. I find it hard to believe anyone would actually do this, but once you find the bug, make whatever change puts the code in the best state to fix the bug and be as maintainable as possible (as long as the change has more business value than the time/risk--don't just do it to do it).

--

--

Amy Blankenship
Amy Blankenship

Written by Amy Blankenship

Full Stack developer at fintech company. I mainly write about React, Javascript, Typescript, and testing.

No responses yet