Content deleted Content added
→Principle: lowercase 'w' these days |
|||
(40 intermediate revisions by 30 users not shown) | |||
Line 1:
{{Short description|Software design pattern}}
The '''hexagonal architecture''', or '''ports and adapters architecture''', is an architectural pattern used in [[software design]]. It aims at creating [[Loose coupling|loosely coupled]] application components that can be easily connected to their software environment by means of ports and [[Adapter pattern|adapters]]. This makes components exchangeable at any level and facilitates test automation.<ref name=":0">{{Cite web|url=
== Origin ==
The hexagonal architecture was invented by [[Alistair Cockburn]] in an attempt to avoid known structural pitfalls in [[Object-oriented analysis and design|object
The term "hexagonal" comes from the graphical conventions that shows the application component like a [[hexagon]]al cell. The purpose was not to suggest that there would be six borders/ports, but to leave enough space to represent the different interfaces needed between the component and the external world.<ref name=":0"
== Principle ==
Line 10 ⟶ 11:
The hexagonal architecture divides a system into several loosely-coupled interchangeable components, such as the application core, the database, the user interface, test scripts and interfaces with other systems. This approach is an alternative to the traditional layered architecture.
Each component is connected to the others through a number of exposed "ports". Communication through these ports follow a given protocol depending on their purpose. Ports and protocols define an abstract [[Application programming interface|API]] that can be implemented by any suitable technical means (e.g. [[method invocation]] in an [[Object-oriented programming|object
The granularity of the ports and their number is not
* a single port could in some case be sufficient (e.g. in the case of a simple service consumer)
* typically, there are ports for event sources (user interface, automatic feeding), notifications (outgoing notifications), [[database]] (in order to interface the component with any suitable DBMS), and administration (for controlling the component);
* in an extreme case, there could be a different port for every [[use case]], if needed.
[[Adapter pattern|Adapters]] are the glue between components and
== Criticism ==
According to [[Martin Fowler (software engineer)|Martin Fowler]], the hexagonal architecture has the benefit of using similarities between presentation layer and data source layer to create symmetric components made of a core surrounded by interfaces, but with the drawback of hiding the inherent asymmetry between a service provider and a service consumer that would better be represented as layers.<ref>{{Cite book|url=https://www.worldcat.org/oclc/50292267|title=Patterns of enterprise application architecture|last=Fowler, Martin,|first=|date=2003|publisher=Addison-Wesley|year=|isbn=0-321-12742-0|___location=Boston|pages=21|oclc=50292267}}</ref>▼
The term "hexagonal" implies that there are 6 parts to the concept, whereas there are only 4 key areas. The term’s usage comes from the graphical conventions that shows the application component like a [[hexagon]]al cell. The purpose was not to suggest that there would be six borders/ports, but to leave enough space to represent the different interfaces needed between the component and the external world.<ref name=":0" />
According to some authors, the hexagonal architecture is at the origin of the [[Microservices|microservice]]<nowiki/>s architecture.<ref>{{Cite book|url=https://www.worldcat.org/oclc/999610958|title=Spring 5.0 microservices : build scalable microservices with Reactive Streams, Spring Boot, Docker, and Mesos|last=Rajesh R V,|first=|publisher=|year=|isbn=978-1-78712-051-8|edition=Second edition|___location=Birmingham, UK|pages=13-14|oclc=999610958}}</ref>▼
▲According to [[Martin Fowler (software engineer)|Martin Fowler]], the hexagonal architecture has the benefit of using similarities between presentation layer and data source layer to create symmetric components made of a core surrounded by interfaces, but with the drawback of hiding the inherent asymmetry between a service provider and a service consumer that would better be represented as layers.<ref>{{Cite book
== Evolution ==
▲According to some authors, the hexagonal architecture is at the origin of the [[
== Variants ==
The onion architecture proposed by
The clean architecture proposed by [[Robert C. Martin]] in 2012 combines the principles of the hexagonal architecture, the onion architecture and several other variants
== See also ==
Line 33 ⟶ 39:
* [[Layer (object-oriented design)]]
* [[Composite structure diagram]]
* [[Object-oriented analysis and design|Object oriented
== References ==
{{Reflist}}
[[Category:Software design]]
|