You built an amazing app on the CodeIgniter framework. Your customers are using it, and your business is making money. But that was eight years ago, and now your developers are saying that it’ll take a complete rewrite of your system to update to version 4. Why is it going to cost another $500k and 18 months (if you’re lucky) to build the same system you already have? Let’s look at why things ended up this way and a method you can take to avoid being in the same place after another eight years.
Frameworks, Libraries, APIs are all wonderful! Useful tools to help you write less code and get your application running quickly! Speed, that’s the word. Speed reminiscent of the Tortoise and the Hare. You probably read a few tutorials and started building right along your favorite framework. You followed the framework’s guidelines and made sure to use all its “time-saving” shortcuts. So now you’re married to the framework. Except the framework isn’t married to you. It’s gone on and changed in a backwards incompatible way, and now the only way you can get the latest version of PHP support is to move to the latest version of the framework.
Is it a problem with frameworks? No, you can make the same mistakes writing your own code as you can by coupling too tightly to a framework. I’m not picking on CodeIgniter here – you can write equally poor code on any number of frameworks, or by yourself.
The problem is change. Frameworks are designed to be easy to use, and hard to move away from. Whether that’s intentional or not, I can only speculate. The solution isn’t “use a different framework” or “don’t use a framework”. The answer is: architect your software better so when changes happen, they are relegated to the periphery of the code. What if you could upgrade framework versions or change to another framework entirely without affecting whatsoever the business logic behind your system? It’s possible!
The most important part of your system is the business logic, and that’s something that everything else should depend on. That’s right, if you intertwine framework, library, database, UI code with your business logic, you’ll end up with a “big ball of mud”. If you can separate them and organize them in a way that everything depends on the business logic, that’ll make databases, PHP versions, even frameworks easy to change.
But now that you’re here, what do you do? You could rewrite your entire software using better software architecture. But that’s a large investment. Here’s the good news. It’s possible to make incremental upgrades to your system that will wean you off dependency on frameworks. You can start small! By making small changes to slowly get your entire system to a better place, you’ll find increased reliability will come along with this method. You can set up tests (which I’d wager you don’t have) for your business logic. You can roll out changes slowly and ensure they work rather than having a huge cutover date and scramble to fix all the bugs you didn’t know you introduced.
You can have hope again! Upgrading legacy applications is completely possible with the proper approach, knowledgeable technicians and bite-sized chunks.