I wish we had more time to refactor this code!
Every week it's the same story: you have to change that codebase. Maybe it's to fix a bug, to tweak some behavior, or to implement a new shiny feature.
You didn't write that code!
It's an undocumented tangled mess. You would love to refactor this code before you change it. But it has no test! Without tests, you're afraid to break something while you refactor—you got burned already, not twice!
OK, so you could start by writing the tests. But you're worried that won't have enough time to meet "the deadline" that was imposed on you…
And there you are: paralyzed because you don't know where to start. Should you begin a huge cleanup and risk the deadline? How can you add tests on a code that was definitely not written to be testable?!
Wherever I start refactoring, it pulls the rest of the app!
You try to unwind the mess and the string just keeps on coming.
It is getting better, but you can't stop because it is not working yet… but it's 9pm now, and your loved ones are mad at you! 😡
You know what happens next…
You stop trying to make sense out of this mayhem. You just Make It Work™. It's not pretty. It's not that bad. There are worse hacks in this spaghetti! You get the job done while making the code worse.
You wish you could just start everything over, but you can't. No time, no budget.
You are not proud of this code—how could you? But you're getting used to it. Clients are pressing you for "more features" and your colleagues don't seem to care.
Your boss doesn't understand why it takes you longer and longer to finish tasks. You raised the point already, but deadlines are still too short and the focus is always on cost and time. No-one cares that your eyes bleed while reading the code!
Exhausting! 😫
If you could at least stop the bleed…
You know what would be great? Working with clean, well-tested code. That would be a breeze to work with…
But this codebase is a minefield. How could you stop making it worse when it would take YEARS to address the Technical Debt!?
What if there was a way to refactor the code AND consistently meeting the deadlines?
Imagine you could refactor as you go, steadily turning the codebase into a testable, easy-to-read, well-designed system! 🌱
If you know the moves, you can give your code first aid that will stop its hemorrhage. How proud and relieved would you feel as you put it back into a healthier shape?
Sure, this system you're maintaining is broken everywhere. It seems to work, but it only really survives with heavy machinery and clever hacks. It looks like it would better to let it go and build a fresh one instead…
But what if you knew the techniques to rescue it?
Imagine cleaning up Legacy Code as you go.
Regardless of the state of your codebase, you will always know where to start. Consistently applying the proper techniques, you can stop the carnage and avoid a costly rewrite.
Most of all, you will keep shipping bug fixes and features as you go.
You don't need to ask permission to refactor when you can do it on the fly!
Refactoring would become second nature to you. Your reflexes will make you clean up Legacy Code in no time! You will consistently meet clients' expectations and inspire your peers.
You can start making this codebase a better place the very next time you touch it. ✨
When you have short deadlines, trying to refactor the code is a risky move… unless you know exactly what you're doing.
Refactor code in no time with this First Aid Kit.
I've built a toolbox of techniques that will help you get your Legacy Code under control. These are the tricks that work the best for me when working with a real-life codebase, with missing tests and short deadlines—sounds familiar, right?
These 14 moves will help you:
- optimize your work to have the maximum impact
- identify what makes code difficult to test
- quickly deploy a safety net around the code you need to touch
- raise up code quality incrementally
- ship anytime!