2016-04-10 21:22:40 +03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								layout: pattern
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								title: Hexagonal Architecture
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								folder: hexagonal
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								permalink: /patterns/hexagonal/
							 
						 
					
						
							
								
									
										
										
										
											2017-03-25 22:07:10 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								pumlformat: svg
							 
						 
					
						
							
								
									
										
										
										
											2016-04-10 21:22:40 +03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								categories: Architectural
							 
						 
					
						
							
								
									
										
										
										
											2021-05-19 10:49:05 -06:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								language: en
							 
						 
					
						
							
								
									
										
										
										
											2016-04-10 21:22:40 +03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								tags:
							 
						 
					
						
							
								
									
										
										
										
											2019-12-13 21:09:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								 -  Decoupling
							 
						 
					
						
							
								
									
										
										
										
											2016-04-10 21:22:40 +03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								---
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-10 21:49:40 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								## Also known as
 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-13 21:09:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-05-22 09:33:50 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  Ports and Adapters
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  Clean Architecture
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  Onion Architecture
							 
						 
					
						
							
								
									
										
										
										
											2016-04-10 21:49:40 +03:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-10 21:22:40 +03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								## Intent
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Allow an application to equally be driven by users, programs, automated test or batch scripts, and to be developed and tested in isolation from its eventual run-time devices and databases.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-12-07 20:01:13 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								## Class diagram
 
							 
						 
					
						
							
								
									
										
										
										
											2016-04-10 21:22:40 +03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## Applicability
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Use Hexagonal Architecture pattern when
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-12 22:44:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  When the application needs to be independent of any frameworks
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  When it is important that the application highly maintainable and fully testable
							 
						 
					
						
							
								
									
										
										
										
											2016-04-10 21:22:40 +03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-06 12:26:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								## Tutorials
 
							 
						 
					
						
							
								
									
										
										
										
											2019-12-13 21:09:28 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-06 12:26:03 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  [Build Maintainable Systems With Hexagonal Architecture ](http://java-design-patterns.com/blog/build-maintainable-systems-with-hexagonal-architecture/ )
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-04-10 21:22:40 +03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								## Real world examples
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2016-11-13 11:37:49 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  [Apache Isis ](https://isis.apache.org/ ) builds generic UI and REST API directly from the underlying domain objects
							 
						 
					
						
							
								
									
										
										
										
											2016-04-10 21:22:40 +03:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## Credits
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  [Alistair Cockburn - Hexagonal Architecture ](http://alistair.cockburn.us/Hexagonal+architecture )