We all know that bad legacy code is a big problem. If we change any part of the code, everything can stop working. It’s a nightmare to maintain a software in this situation. Any simple bug turns into a big monster. Instead of trying to mend the code, refactor it!
But what are the mistakes we make to not refactor the code?
1 – Focus on Short Deadlines
In many companies, time is very short. We just spend a lot of time fixing the bugs, we test it, it works. Until then it’s ok, but most times another part of the application just breaks. Simply because the code is too coupled. If we fall in the illusion of correcting those bugs all the time because we don’t have time the consequence is that more bugs will appear.
2 – Focus on Numbers
Numbers, numbers, and numbers. We software developers have to take action to avoid situations where we have to generate numbers. If we accept generating numbers we will become part of the problem.
Sometimes we are told to fix 10 bugs but we again would be entering in the infinite cycle.
Fix bugs -> Generate other bugs -> Fix bugs -> Generate more bugs -> ….
The problem has to be solved by the root cause. The code must be refactored!
3 – Fear of Breaking the Application
It’s very common and natural to be afraid of breaking an important part of the application. Refactoring a bad legacy code without automated tests is obviously a risk.
What do you want to do? Do you want to be in your comfort-zone facing the nightmare of maintaining bad code? Sometimes we have to take the responsibility if something happens and be able to take action to reduce risks. A very simple action would be to get the test team by your side, you can create a separated branch to work and then, make it happen. Take action and improve the quality of the environment you are working for.
4 – Lack Negotiation Skills
Some time ago I thought that any other skill not being technical was useless. I was completely wrong. How can we propose a good technology for the project if we are unable to negotiate? Soft Skills are extremely important and we need to master them if we really want to do an amazing work. We can contribute much more improving them.
5 – Fear of Losing the Job
It’s tough to take the hard path, but certainly, it makes a great difference in your career. We want to cut the bad from the root. Also, you can lose your job breaking some important part of the software. That’s why you’ve got to bring everyone on your side to work with you, convince them to take the risk with you. It’s always better to see a high-quality code easy to maintain.
6 – Lack of business knowledge
We must be always curious about the business of the application we work on. How can we be sure everything is working fine if we don’t know the business? It’s not possible to test the application without knowing the business. Find a way to know better the business if you don’t know it yet. If you don’t have enough business knowledge you can always have someone by your side that can support you with this.
7 – Not knowing the Best Programming Practices
To refactor the code in the best way we must know the best programming techniques. Simple things make a big difference like organized packages, method and variable names.
Simple concepts as well:
DRY – Don’t repeat yourself
KIS – Keep it simple
Apply Design Patterns
Remember, develop your code as if there is a psychopath that knows where you live maintaining your code.
What pill do you want to take? The blue one and keep everything in “control” inside your comfort zone? Or you want to take the red where you will face tough challenges but will make the world better?
There is more! You can get this FREE E-Book too!
No Bugs, No Stress – Create a Life-Changing Software Without Destroying Your Life
Keep up improving yourself!