2024-01-03 20:00:00 +00:00
|
|
|
---
|
|
|
|
title: >
|
2024-02-07 20:01:19 +00:00
|
|
|
How much refactoring should I be doing?
|
2024-01-03 20:00:00 +00:00
|
|
|
pubDate: 2023-09-17
|
|
|
|
permalink: >-
|
2024-02-07 20:01:19 +00:00
|
|
|
archive/2023/09/17/how-much-refactoring-should-i-be-doing
|
2024-01-03 20:00:00 +00:00
|
|
|
tags:
|
2024-02-07 20:01:19 +00:00
|
|
|
- software-development
|
|
|
|
- test-driven-development
|
|
|
|
- automated-testing
|
|
|
|
- refactoring
|
2024-01-03 20:00:00 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
I watched a webinar recently, and one of the panellists asked, "How much refactoring should I be doing?".
|
|
|
|
|
|
|
|
The reply was, "More than you're doing now.".
|
|
|
|
|
|
|
|
It was quite tongue-in-cheek, but I agree that, in general, code isn't refactored enough.
|
|
|
|
|
|
|
|
One main reason is a fear of introducing regressions, and to avoid that, you need a good automated test suite.
|
|
|
|
|
|
|
|
If you break the existing functionality whilst refactoring, you want the test suite to fail so you can identify and fix the regression.
|
|
|
|
|
|
|
|
If the test suite passes, you can release the new code.
|
|
|
|
|
|
|
|
How many tests and how much coverage do you need? There's no specfic answer - enough for you to be confident everything still works.
|