For the last two years, Custom House software development team has been making a major push to apply DDD on its projects at both the tactical and strategic levels. This is the second part of their two-part report.
Custom House’s new currency exchange system is integrated with a legacy system. After a few years of growth, the two systems were so intricately tangled that even small changes made in the integration layer would have unpredictable side effects. Refactoring on the integration layer was risky and time consuming. The situation called for a revolutionary redesign.
The solution was to introduce an anticorruption layer to isolate the two systems. This layer encapsulated the translation of conceptual objects and actions between the two systems, insulating the domain layer from knowing the existence of the other system. By freeing the domain layer from performing tasks that were only relevant to the other system, the anticorruption layer allowed additional external systems to be integrated without requiring any changes to the domain layer itself. Full implementation of an anticorruption layer reduced overhead of legacy integration from 30% of total development to 10%.
The biggest challenge in implementing the anticorruption layer is to control the complexity of translation work. This was managed in an innovative way: by building an object model reflecting the implicit model of the legacy system. Our experiences show that an external system need not be object-oriented for its model to be adequately abstracted, and this has proven to be the key to a clean and extensible translation.