Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement an Anti-Corruption Layer correctly

I'm starting with DDD philosophy and I'd like to implement an integration with a legacy system that we have here. In my researches in the internet, I found some articles and samples but I must to admit: is pretty hard to understand how to do that integration correctly.

Before to ask this question, I did a search here but the results were not useful for me, so I'd like to know if is possible to send or show me a implementation sample of an ACL.

Here I have this items:

  • The Legacy system
  • The legacy database (I need to access)
  • The new application that will be created using the DDD approach

The initial idea is to access that database throughout NHibernate, creating just some the needed mapping classes, the domain entities and implement the business rules. According to Eric Evans, this strategy is called [Bubble Context][1]. I think this strategy will solve my problem, but I need some sample to do that in a right way.

Can someone help me?

like image 755
Marco Antonio Avatar asked Jul 25 '13 20:07

Marco Antonio


People also ask

What is Anti-corruption layer?

The anti-corruption layer contains all of the logic necessary to translate between the two systems. The layer can be implemented as a component within the application or as an independent service.

What is Anti-corruption layer Mulesoft?

An Anti-Corruption Layer (ACL) is a set of patterns placed between the domain model and other bounded contexts or third party dependencies. The intent of this layer is to prevent the intrusion of foreign concepts and models into the domain model.

What is DDD Anti-corruption?

DDD defines an anti-corruption layer is an adapter pattern that isolates one part of a system, known in DDD as a bounded context, from another bounded context. Its job is to ensure that the semantics in one bounded concept do not “corrupt” the other bounded concept's semantics.

Is DDD a design pattern?

Where to draw the boundaries is the key task when designing and defining a microservice. DDD patterns help you understand the complexity in the domain. For the domain model for each Bounded Context, you identify and define the entities, value objects, and aggregates that model your domain.


1 Answers

The ACL is a pattern and not just the piece of code. In what you described you didn't say do you have strong dependencies upon legacy system or you just want to have some independent piece of code built into current system? With this you could decide will be your ACL just a service to database or will it incorporate some wrapping upon legacy system logic?

The actual pieces that you'd put into the ALC are highly depend on your implementation. There is a generic schema of what you're asking for: enter image description here

You could find more info in Eric Evan's talk.

like image 59
Denys Denysenko Avatar answered Dec 28 '22 23:12

Denys Denysenko