Knowledge

Hexagonal architecture (software)

Source πŸ“

87: 168:, 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. 147:
are the glue between components and the outside world. They tailor the exchanges between the external world and the ports that represent the requirements of the inside of the application component. There can be several adapters for one port, for example, data can be provided by a user through a GUI
188:
The onion architecture proposed by Jeffrey Palermo in 2008 is similar to the hexagonal architecture: it also externalizes the infrastructure with interfaces to ensure loose coupling between the application and the database. It decomposes further the application core into several concentric rings
200:
in 2012 combines the principles of the hexagonal architecture, the onion architecture and several other variants. It provides additional levels of detail of the component, which are presented as concentric rings. It isolates adapters and interfaces (user interface, databases, external systems,
94:
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.
98:
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
156:
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
161:
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.
78:
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.
71:
wiki; in 2005 Cockburn renamed it "Ports and adapters". In April 2024, Cockburn published a comprehensive book on the subject, coauthored with Juan Manuel Garrido de Paz.
538: 480: 503: 431: 373: 543: 129:
typically, there are ports for event sources (user interface, automatic feeding), notifications (outgoing notifications),
237: 52: 213:
with the strict rule that dependencies shall only exist between an outer ring to an inner ring and never the contrary.
340: 165: 100: 366:
Spring 5.0 microservices : build scalable microservices with Reactive Streams, Spring Boot, Docker, and Mesos
133:(in order to interface the component with any suitable DBMS), and administration (for controlling the component); 317: 456: 227: 210: 56: 232: 108: 68: 35:
application components that can be easily connected to their software environment by means of ports and
424:
Learning NHibernate 4 : explore the full potential of NHibernate to build robust data access code
74:
The term "hexagonal" comes from the graphical conventions that shows the application component like a
398: 533: 126:
a single port could in some case be sufficient (e.g. in the case of a simple service consumer);
222: 112: 190: 8: 265: 509: 499: 474: 437: 427: 379: 369: 346: 336: 104: 48: 303: 197: 39:. This makes components exchangeable at any level and facilitates test automation. 144: 36: 28: 201:
devices) in the outer rings of the architecture and leaves the inner rings for
64: 60: 32: 513: 496:
Clean architecture : a craftsman's guide to software structure and design
176:
According to some authors, the hexagonal architecture is at the origin of the
148:
or a command-line interface, by an automated data source, or by test scripts.
527: 441: 383: 289: 177: 350: 206: 116: 86: 202: 137: 130: 122:
The granularity of the ports and their number is not constrained:
158: 75: 136:
in an extreme case, there could be a different port for every
103:
that can be implemented by any suitable technical means (e.g.
368:(Second ed.). Packt Publishing. pp. 13–14. 51:
in an attempt to avoid known structural pitfalls in
493: 525: 304:"Ports And Adapters Architecture in the C2 Wiki" 421: 333:Patterns of enterprise application architecture 209:. The clean architecture uses the principle of 330: 479:: CS1 maint: multiple names: authors list ( 363: 457:"The Clean architecture | Clean Coder Blog" 47:The hexagonal architecture was invented by 55:, such as undesired dependencies between 539:Architectural pattern (computer science) 263: 85: 396: 290:"Hexagonal Architecture in the C2 Wiki" 526: 454: 426:. Packt Publishing. pp. 249–250. 399:"The Onion Architecture : part 1" 27:, is an architectural pattern used in 259: 257: 255: 253: 67:. It was discussed at first on the 238:Object oriented analysis and design 196:The clean architecture proposed by 13: 318:"Hexagonal Architecture Explained" 14: 555: 455:Martin, Robert, C. (2012-08-12). 264:Cockburn, Alistair (2005-04-01). 250: 90:Example of hexagonal architecture 487: 397:Jeffrey, Palermo (2008-07-29). 53:object-oriented software design 25:ports and adapters architecture 448: 415: 390: 357: 335:. Addison-Wesley. p. 21. 324: 310: 296: 282: 228:Layer (object-oriented design) 1: 243: 171: 151: 81: 7: 544:Object-oriented programming 233:Composite structure diagram 216: 183: 69:Portland Pattern Repository 10: 560: 494:Martin, Robert C. (2017). 42: 422:Chatekar, Suhas (2015). 403:Programming with Palermo 266:"Hexagonal architecture" 109:object-oriented language 331:Fowler, Martin (2003). 16:Software design pattern 113:remote procedure calls 91: 31:. It aims at creating 21:hexagonal architecture 364:Rajesh R. V. (2017). 223:Architecture patterns 89: 59:and contamination of 270:alistair.cockburn.us 211:dependency inversion 191:inversion of control 461:blog.cleancoder.com 92: 505:978-0-13-449416-6 498:. Prentice Hall. 433:978-1-78439-206-2 375:978-1-78712-051-8 105:method invocation 49:Alistair Cockburn 551: 518: 517: 491: 485: 484: 478: 470: 468: 467: 452: 446: 445: 419: 413: 412: 410: 409: 394: 388: 387: 361: 355: 354: 328: 322: 321: 314: 308: 307: 300: 294: 293: 286: 280: 279: 277: 276: 261: 198:Robert C. Martin 559: 558: 554: 553: 552: 550: 549: 548: 534:Software design 524: 523: 522: 521: 506: 492: 488: 472: 471: 465: 463: 453: 449: 434: 420: 416: 407: 405: 395: 391: 376: 362: 358: 343: 329: 325: 316: 315: 311: 302: 301: 297: 288: 287: 283: 274: 272: 262: 251: 246: 219: 186: 174: 154: 84: 45: 33:loosely coupled 29:software design 17: 12: 11: 5: 557: 547: 546: 541: 536: 520: 519: 504: 486: 447: 432: 414: 389: 374: 356: 341: 323: 309: 295: 281: 248: 247: 245: 242: 241: 240: 235: 230: 225: 218: 215: 185: 182: 180:architecture. 173: 170: 153: 150: 142: 141: 134: 127: 83: 80: 65:business logic 61:user interface 44: 41: 15: 9: 6: 4: 3: 2: 556: 545: 542: 540: 537: 535: 532: 531: 529: 515: 511: 507: 501: 497: 490: 482: 476: 462: 458: 451: 443: 439: 435: 429: 425: 418: 404: 400: 393: 385: 381: 377: 371: 367: 360: 352: 348: 344: 342:0-321-12742-0 338: 334: 327: 319: 313: 305: 299: 291: 285: 271: 267: 260: 258: 256: 254: 249: 239: 236: 234: 231: 229: 226: 224: 221: 220: 214: 212: 208: 204: 199: 194: 192: 181: 179: 178:microservices 169: 167: 166:Martin Fowler 164:According to 162: 160: 149: 146: 139: 135: 132: 128: 125: 124: 123: 120: 118: 114: 110: 106: 102: 96: 88: 79: 77: 72: 70: 66: 62: 58: 54: 50: 40: 38: 34: 30: 26: 22: 495: 489: 464:. Retrieved 460: 450: 423: 417: 406:. Retrieved 402: 392: 365: 359: 332: 326: 312: 298: 284: 273:. Retrieved 269: 195: 187: 175: 163: 155: 143: 140:, if needed. 121: 117:Web services 97: 93: 73: 46: 24: 20: 18: 528:Categories 514:1004983973 466:2019-08-12 408:2019-08-12 275:2020-11-18 244:References 63:code with 442:937787252 384:999610958 203:use cases 172:Evolution 159:hexagonal 152:Criticism 82:Principle 76:hexagonal 475:cite web 351:50292267 217:See also 207:entities 184:Variants 145:Adapters 138:use case 131:database 37:adapters 512:  502:  440:  430:  382:  372:  349:  339:  189:using 107:in an 57:layers 43:Origin 115:, or 23:, or 510:OCLC 500:ISBN 481:link 438:OCLC 428:ISBN 380:OCLC 370:ISBN 347:OCLC 337:ISBN 205:and 19:The 119:). 101:API 530:: 508:. 477:}} 473:{{ 459:. 436:. 401:. 378:. 345:. 268:. 252:^ 193:. 111:, 516:. 483:) 469:. 444:. 411:. 386:. 353:. 320:. 306:. 292:. 278:.

Index

software design
loosely coupled
adapters
Alistair Cockburn
object-oriented software design
layers
user interface
business logic
Portland Pattern Repository
hexagonal
Example of hexagonal architecture with an inner hexagon representing the application core, and an outer hexagon for the adapters, the border between the two being the ports
API
method invocation
object-oriented language
remote procedure calls
Web services
database
use case
Adapters
hexagonal
Martin Fowler
microservices
inversion of control
Robert C. Martin
use cases
entities
dependency inversion
Architecture patterns
Layer (object-oriented design)
Composite structure diagram

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

↑