Rewrite or Strangler Fig Design Pattern?
- Peter St Clair
- Insights
Following on from our previous post The risks of staying on AngularJS after Dec ’21 , in the post we talk about the two widely recommended approaches for UI legacy migrations – Rewrite and Strangler Fig Design Pattern.
Before you start your migration, we recommend that you take this opportunity to think about your target technology and whether the latest Angular framework is right for your application.
Choosing your new target technology
Your choice of new technology to migrate to, should really come down to what suits your individual business needs.
Depending on things like:
- the size and complexity of the application
- the current skillsets that you have available
- wider organisation tech roadmaps/constraints
- the lifespan of the application
- the speed and cost of delivery
More modern frameworks today, such as Angular, React, Vue are all good options, and each have their own set of strengths and weaknesses. A lot of engineers will have their standout favourite, but ultimately the choice should be based on the use case, not personal preference.
For the purposes of this post, we won’t dive into how you would go about choosing your target technology, but if you have any questions feel free to contact us.
Rewrite
Used for simple and smaller applications, the rewrite approach is often the quickest and simplest. It avoids any of the complexities around running the legacy AngularJS framework side by side, with the new framework.
Not having to deal with the issues that surface when combining multiple UI frameworks on one page will be a big advantage to choosing the Rewrite approach.
Common issues might include:
- developer inefficiency dealing with 2 frameworks
- UI performance degradations (network performance, CPU load)
- UX inconsistencies
- Interop between the two frameworks
- build & packaging tooling conversions / incompatibilities.
If the scope is relatively small, then having a modern, well-architected code base, with new foundations is often the most effective. Simpler, faster-to-release, and more cost-effective wins over struggling with the continued complexities of unwanted baggage.
Strangler Fig Design Pattern
The Strangler Fig Design Pattern is a common method of incrementally creating a new application around the edges of the old, letting it grow over time until the old system is eventually completely replaced.
This approach is best for larger and more complex applications, where the Rewrite approach is not viable. Reasons for the Strangler Fig design pattern vs. Rewrite may include:
- Cost – the cost is too high, it will take too long to Rewrite/replace everything in a single go
- Risk – The business cannot afford the risk and interruption of the day-to-day operations
- Business Critical – The application is critical to the core operations of the business, and therefore ‘downtime’ is not possible.
The Strangler Fig design pattern allows you to introduce a new feature or redesign an old one with a different, potentially more modern technology. This approach allows teams to continue delivering value and features to the final users while gradually replacing part or whole of a legacy monolithic UI application.
Which approach is best:
Rewrite or Strangler Fig Design Pattern?
Depending on your application deciding on a Rewrite or Strangler Fig Design Pattern there are a few things you should keep in mind.
Are you able to freeze development on the legacy app during the rewrite process? If more features are developed simultaneously, it’s like climbing a growing mountain. The top can never be reached.
What is the size of your application? As mentioned, a complete rewrite is more suitable for small to medium sized applications. It will not be a swift task to tackle if the legacy apps have hundreds of screens and components to rewrite. The risk of a halted project could spontaneously cause the whole effort to go to waste.
How compatible is the old code with the new version and its adherence to industry standards? How complex it is to make the old code compatible could be another reason to choose the rewrite approach. Before you can start, a whole lot of refactoring on the legacy app may be required before the developers can even import the upgrade module in.
What next?
AngularJS will approach end-of-life on the 31st of December 2021. If you are still thinking about how to approach the migration process, please contact us, and we’ll be more than happy to share our experience and expert advice with you.
Playtime Solutions’
AKS Best Practice Guide
A 23 page best-practice checklist, leveraging Playtime Solutions’ hands-on experience in designing, developing and delivering enterprise-grade application. This guide assists IT and DevOps professionals in creating an enterprise-grade Kubernetes environment in Microsoft AKS.