Starting Over - A Very Risky Choice
Refactoring is always going to be a part of any software development project. The only question is how to do the refactoring in a way that provides the minimum disruption and the maximum chances for success. By keeping changes local, it’s possible to dramatically increase the quality of the outcomes while keeping a steady stream of improvements to the software.
There’s a popular coding joke that asks “Why did it only take the Lord six days to create the entire world?” The answer: He started from scratch. Developers laugh because every programmer has had the experience of trying to improve code written by someone else, and struggling to understand why it was written that way in the first place. Handling someone else’s code is one of the trickiest—and sometimes most frustrating—parts of programming. For that reason, it can be tempting to want to get rid of an entire project or large modules and just start from scratch.
That’s a very risky approach and it almost never succeeds.
Handling a legacy application, website or software project is a lot more like the joke that asks how to eat an elephant: one bite at a time. We have a deep respect for working systems, as complex as they are. It takes time, persistence and curiosity to build the extensive background required to get a complete understanding of complex systems.
More often than not, when you start to dive into the code, you find some odd quirk which is unclear but was developed for a particular business reason. Maybe in some geographies they don’t have PayPal and needed to integrate a cash-on-delivery software module programmed in some other language. Perhaps a particular supplier only takes orders over a certain size, so the inventory system has to create a certain backlog before triggering an order. Each of the peculiarities of the specific business leads to peculiarities in the code. Therefore, when you refactor, you are going to have to find alternatives - or recognize the wisdom of the original program and work around it.
Optimizing for upgrades
When optimizing code for upgrades, faster build times, or better page rending responses, the first step is looking at how to decouple different parts of code into more modular fragments. Decoupling code requires a more modular approach, where each module has calls or cues to communicate between different parts of the system.
Once you’ve decoupled the modules, you can start to tackle each part of the legacy code and make improvements. Perhaps it does make sense to get rid of an outdated open source script or replace an entire module with an updated code base. Maybe it’s better to simply tweak some of the database calls. Once you’ve got the code broken down into manageable chunks, you can make internal changes that update the functionality without affecting any of the other modules in the project. You can then test those changes, and move on.
Code decoupling also has major advantages when it comes to upgrades, bug fixes, and other types of improvements. By taking a modular approach, it’s possible to phase out functionality that’s no longer needed, identify and fix edge cases, and pinpoint bugs. It also provides developers a cleaner environment for reading legacy code and understanding the purpose of each section of code they are working on.
Reach out to find out more about why the top global corporations prefer Clevertech as their outsourced development team.
If you’d like to find out more about our culture and current job openings, check out our YouTube channel and visit clevertech.careers.
Want to peak into our daily work? Our coaches recount real world situations shared as learning opportunities to build soft skills. We share frameworks, podcasts and thinking tools for sr software developers.
Keep on readingGo to Blog home
The (remote) opportunities
We expect professionalism and client service, so we can offer a deeply caring experience for our clients. In return, you get freedom to work wherever you want. No timesheets, no big brother watching every move. We trust you to know what’s best to find the right solution.