Onion architecture compared to hexagonal

后端 未结 4 557
野趣味
野趣味 2021-01-30 05:36

Is there any difference between them (onion | hexagonal), from my understanding they are just the same, they focus upon the domain which is at the core of the application and sh

4条回答
  •  抹茶落季
    2021-01-30 05:54

    Hexagonal Architecture, also know as the ports focuses around infrastructure concerns.

    Onion architecture focuses around domain concerns.

    Taking the example of the persistence layer, you would use an ORM in order to send and retrieve data from a data store. The ORM represents an infrastructure concern and should be placed outside domain concerns, this is called an adapter and can be later changed with another ORM. Inside your domani (Onion) you would define interfaces so that your domain would not be concerned with the infrastructure, these interfaces are called ports.

提交回复
热议问题