Integration with legacy systems is often challenging. Quite often the legacy systems would be a playground of obsolete APIs and convoluted data schemes. In order to provide compatibility with the older system, the newer system often has to share some of these undesirable traits of the legacy systems and corrupt them. Usually, developers tend to have few options when faced with legacy systems.
- Abandon the old system – If it is possible, there is always the option to ditch the legacy system, considering the cost of integrating the legacy system. May be the old system is not quite adding the value it seem to provide if integrated.
- Conforming the legacy system – The other choice would be to adopt the legacy system, corrupting the new system with APIs and Data structures of the old system. This is an option if the organization is not planning to replace the legacy system in longer run as it, even if not quite the best possible one, is acceptable enough. In such scenarios, the newer system could be made to conform to the legacy system skipping the need to reinvent the wheel in some areas.
If both of the above choices don’t make sense to your need, it would be wise to implement the Anti Corruption Layer. Remember, the Anti Corruption layer adds its own layer of complexity in terms of maintenance and support. So it would be better to carefully consider the above choices before committing to work on the ACL.
Anti Corruption Layer (ACL)
Anti Corruption Layer, a concept discussed first in Domain Driven Development, adds a layer that would help in protecting the new system from corruption from legacy applications. These are also useful when required to maintain the sanity of your layer when there are changes to external systems it depends on. The Anti Corruption Layer could be uni/bi-directional depending on the needs of the system.
The Anti Corruption Layer uses a combination of Fascade, Adpater, and Translators to isolate the system. It helps in simplifying the interfaces from the legacy system and providing a simplified, yet improved interface integration with the newer system. The translators could help in mapping incompatible models with each other.
With the Anti Corruption Layer in place, the legacy system would now communicate with the newer system only through the ACL. The ACL takes the complete responsibility to translate, simplify and adapt the calls to make it incompatible with the newer system. This ensures the undesirable components/traits of the older legacy system do not spill over to the newer system and is contained within the ALC.
The ACL is useful in scenarios when the legacy system could not be avoided completely, or even when the migration process takes over a period of time during which the legacy system is valid.