Hexagonal Architecture - Alistair Cockburn
Hexagonal Architecture - Alistair Cockburn
CART
CONTACT / HIRE ALISTAIR
Hexagonal architecture
Tags
Create your application to work without either a UI or a database so you can
Agile
run automated regression-tests against the application, work when the
development
database becomes unavailable, and link applications together without any
user involvement. Articles
Being Blog
Japanese translation of this article at
Books
http://blog.tai2.net/hexagonal_architexture.html
Categories
Spanish translation of this article at
http://academyfor.us/posts/arquitectura-hexagonal courtesy of Arthur
Mauricio Delgadillo
original explanation w updates at http://wiki.c2.com/?HexagonalArchitecture Recent posts
and http://wiki.c2.com/?PortsAndAdaptersArchitecture
Donate buttons
What users
are saying
Allow an application to equally be driven by users, programs, automated test terrorist march
Top Rated
When any driver wants to use the application at a port, it sends a request
Products
that is converted by an adapter for the specific technology of the driver into
Agile
an usable procedure call or message, which passes that to the application
port. The application is blissfully ignorant of the driver’s technology. When
the application has something to send out, it sends it out through a port to
an adapter, which creates the appropriate signals needed by the receiving Software
technology (human or automated). The application has a semantically sound Development: The
interaction with the adapters on all sides of it, without actually knowing the Cooperative Game
nature of the things on the other side of the adapters. (Agile Software
Development
Figure 1 : Hexagonal architecture basic.gif Series)
The agile model of
software
development has
taken the world by
storm. Now, in Agile
Software
Development,
Second Edition, one
of agile’s leading
pioneers updates
Motivation his Jolt Productivity
award-winning book
One of the great bugaboos of software applications over the years has been
to reflect all that’s
infiltration of business logic into the user interface code. The problem this
been learned about
causes is threefold:
agile development
First, the system can’t neatly be tested with automated test suites since its original
because part of the logic needing to be tested is dependent on oft- introduction.
changing visual details such as field size and button placement;
For the exact same reason, it becomes impossible to shift from a
Rédiger des cas
human-driven use of the system to a batch-run system;
d'utilisation
For still the same reason, it becomes difficult or impossible to allow
the program to be driven by another program when that becomes
attractive.
efficaces (French
The attempted solution, repeated in many organizations, is to create a new
edition)
layer in the architecture, with the promise that this time, really and truly, no
business logic will be put into the new layer. However, having no mechanism
Crystal
to detect when a violation of that promise occurs, the organization finds a
Clear:
few years later that the new layer is cluttered with business logic and the old
Agile
problem has reappeared.
Software-
Imagine now that ‘’every’’ piece of functionality the application offers were Entwicklung für
available through an API (application programmed interface) or function call. Kleine Teams
In this situation, the test or QA department can run automated test scripts (German edition)
against the application to detect when any new coding breaks a previously
working function. The business experts can create automated test cases,
before the GUI details are finalized, that tells the programmers when they
Recent
have done their work correctly (and these tests become the ones run by the Tweets
test department). The application can be deployed in ‘’headless’’ mode, so
only the API is available, and other programs can make use of its still chao
@Tot… · M
functionality — this simplifies the overall design of complex application
Replying to @Tothe
suites and also permits business-to-business service applications to use
he/she did get it rig
each other without human intervention over the web. Finally, the automated fixed it - so, all goo
function regression tests detect any violation of the promise to keep - just a bunch pers
needed to get past
business logic out of the presentation layer. The organization can detect, and
then correct, the logic leak.
still chao
An interesting similar problem exists on what is normally considered “the
@Tot… · M
other side” of the application, where the application logic gets tied to an
Replying to @Tothe
external database or other service. When the database server goes down or
keep it going :)))
undergoes significant rework or replacement, the programmers can’t work
because their work is tied to the presence of the database. This causes delay
costs and often bad feelings between the people.
1
It is not obvious that the two problems are related, but there is a symmetry
between them that shows up in the nature of the solution.
Get Social
Nature of the Solution
Both the user-side and the server-side problems actually are caused by the
same error in design and programming — the entanglement between the
business logic and the interaction with external entities. The asymmetry to
exploit is not that between ‘’left’’ and ‘’right’’ sides of the application but
between ‘’inside’’ and ‘’outside’’ of the application. The rule to obey is that
code pertaining to the ‘’inside’’ part should not leak into the ‘’outside’’ part.
For each external device there is an ‘’adapter’’ that converts the API
definition to the signals needed by that device and vice versa. A graphical
user interface or GUI is an example of an adapter that maps the movements
of a person to the API of the port. Other adapters that fit the same port are
automated test harnesses such as FIT or Fitnesse, batch drivers, and any
code needed for communication between applications across the enterprise
or net.
Many applications have only two ports: the user-side dialog and the
database-side dialog. This gives them an asymmetric appearance, which
makes it seem natural to build the application in a one-dimensional, three-,
four-, or five-layer stacked architecture.
There are two problems with these drawings. First and worst, people tend
not to take the “lines” in the layered drawing seriously. They let the
application logic leak across the layer boundaries, causing the problems
mentioned above. Secondly, there may be more than two ports to the
application, so that the architecture does not fit into the one-dimensional
layer drawing.
The hexagonal, or ports and adapters, architecture solves these problems by
noting the symmetry in the situation: there is an application on the inside
communicating over some number of ports with things on the outside. The
items outside the application can be dealt with symmetrically.
(a) the inside-outside asymmetry and the similar nature of ports, to get away
from the one-dimensional layered picture and all that evokes, and
(b) the presence of a defined number of different ports – two, three, or four
(four is most I have encountered to date).
The hexagon is not a hexagon because the number six is important, but
rather to allow the people doing the drawing to have room to insert ports
and adapters as they need, not being constrained by a one-dimensional
layered drawing. The term ‘’hexagonal architecture’’ comes from this visual
effect.
The term “port and adapters” picks up the ‘’purposes’’ of the parts of the
drawing. A port identifies a purposeful conversation. There will typically be
multiple adapters for any one port, for various technologies that may plug
into that port. Typically, these might include a phone answering machine, a
human voice, a touch-tone phone, a graphical human interface, a test
harness, a batch driver, an http interface, a direct program-to-program
interface, a mock (in-memory) database, a real database (perhaps different
databases for development, test, and real use).
Structure
Figure 2 : Hexagonal architecture with adapters.gif
Figure 2 shows an application having two active ports and several adapters
for each port. The two ports are the application-controlling side and the
data-retrieval side. This drawing shows that the application can be equally
driven by an automated, system-level regression test suite, by a human user,
by a remote http application, or by another local application. On the data
side, the application can be configured to run decoupled from external
databases using an in-memory oracle, or ‘’mock’’, database replacement; or
it can run against the test- or run-time database. The functional specification
of the application, perhaps in use cases, is made against the inner hexagon’s
interface and not against any one of the external technologies that might be
used.
1. With a FIT test harness driving the application and using the mock (in-
memory) database substituting for the real database;
2. Adding a GUI to the application, still running off the mock database;
3. In integration testing, with automated test scripts (e.g., from Cruise
Control) driving the application against a real database containing test
data;
4. In real use, with a person using the application to access a live
database.
Sample Code
The simplest application that demonstrates the ports & adapters fortunately
comes with the FIT documentation. It is a simple discount computing
application:
In our adaptation, the amount will come from the user and the rate will
come from a database, so there will be two ports. We implement them in
stages:
Thanks to Gyan Sharma at IHC for providing the code for this example.
TestDiscounter
amount discount()
100 5
200 10
Note that the column names will become class and function names in our
program. FIT contains ways to get rid of this “programmerese”, but for this
article it is easier just to leave them in.
Knowing what the test data will be, we create the user-side adapter, the
ColumnFixture that comes with FIT as shipped:
import fit.ColumnFixture;
public class TestDiscounter extends ColumnFixture
{
private Discounter app = new Discounter();
public double amount;
public double discount()
{ return app.discount(amount); }
}
That’s actually all there is to the adapter. So far, the tests run from the
command line (see the FIT book for the path you’ll need). We used this one:
set FIT_HOME=/FIT/FitLibraryForFit15Feb2005
java -cp %FIT_HOME%/lib/javaFit1.1b.jar;%FIT_HOME%/dist/fitLibraryForFit.jar;src;bin
fit.FileRunner test/Discounter.html TestDiscount_Output.html
FIT produces an output file with colors showing us what passed (or failed, in
case we made a typo somewhere along the way).
At this point the code is ready to check in, hook into Cruise Control or your
automated build machine, and include in the build-and-test suite.
...
Discounter app = new Discounter();
public void actionPerformed(ActionEvent event)
{
...
String amountStr = text1.getText();
double amount = Double.parseDouble(amountStr);
discount = app.discount(amount));
text3.setText( "" + discount );
...
At this point the application can be both demoed and regression tested. The
user-side adapters are both running.
To hook this adapter into the Discounter application, we need to update the
application itself to accept a repository adapter to use, and the have the (FIT
or UI) user-side adapter pass the repository to use (real or mock) into the
constructor of the application itself. Here is the updated application and a
FIT adapter that passes in a mock repository (the FIT adapter code to choose
whether to pass in the mock or real repository’s adapter is longer without
adding much new information, so I omit that version here).
import repository.RepositoryFactory;
import repository.RateRepository;
public class Discounter
{
private RateRepository rateRepository;
public Discounter(RateRepository r)
{
super();
rateRepository = r;
}
public double discount(double amount)
{
double rate = rateRepository.getRate( amount );
return amount * rate;
}
}
import app.Discounter;
import fit.ColumnFixture;
public class TestDiscounter extends ColumnFixture
{
private Discounter app =
new Discounter(RepositoryFactory.getMockRateRepository());
public double amount;
public double discount()
{
return app.discount( amount );
}
}
For a different implementation, using Ruby and Rack for browser usage, see
https://github.com/totheralistair/SmallerWebHexagon
Application Notes
The Left-Right Asymmetry
The ports and adapters pattern is deliberately written pretending that all
ports are fundamentally similar. That pretense is useful at the architectural
level. In implementation, ports and adapters show up in two flavors, which
I’ll call ‘’primary’’ and ‘’secondary’’, for soon-to-be-obvious reasons. They
could be also called ‘’driving’’ adapters and ‘’driven’’ adapters.
The alert reader will have noticed that in all the examples given, FIT fixtures
are used on the left-side ports and mocks on the right. In the three-layer
architecture, FIT sits in the top layer and the mock sits in the bottom layer.
This is related to the idea from use cases of “primary actors” and “secondary
actors”. A ‘’primary actor’’ is an actor that drives the application (takes it out
of quiescent state to perform one of its advertised functions). A ‘’secondary
actor’’ is one that the application drives, either to get answers from or to
merely notify. The distinction between ‘’primary ‘’and’’ secondary ‘’lies in
who triggers or is in charge of the conversation.
The natural test adapter to substitute for a ‘’primary’’ actor is FIT, since that
framework is designed to read a script and drive the application. The natural
test adapter to substitute for a ‘’secondary’’ actor such as a database is a
mock, since that is designed to answer queries or record events from the
application.
These observations lead us to follow the system’s use case context diagram
and draw the ‘’primary ports ‘’and’’ primary adapters’’ on the left side (or
top) of the hexagon, and the ‘’secondary ports’’ and ‘’secondary adapters’’ on
the right (or bottom) side of the hexagon.
Understanding the ports and adapters architecture, we can see that the use
cases should generally be written at the application boundary (the inner
hexagon), to specify the functions and events supported by the application,
regardless of external technology. These use cases are shorter, easier to
read, less expensive to maintain, and more stable over time.
The weather system described in the Known Uses has four natural ports: the
weather feed, the administrator, the notified subscribers, the subscriber
database. A coffee machine controller has four natural ports: the user, the
database containing the recipes and prices, the dispensers, and the coin
box. A hospital medication system might have three: one for the nurse, one
for the prescription database, and one for the computer-controller
medication dispensers.
Known Uses
Figure 4 : Hexagonal architecture complex example.gif
Figure 4 shows an application with four ports and several adapters at each
port. This was derived from an application that listened for alerts from the
national weather service about earthquakes, tornadoes, fires and floods, and
notified people on their telephones or telephone answering machines. At
the time we discussed this system, the system’s interfaces were identified
and discussed by ‘’technology, linked to purpose’’. There was an interface for
trigger-data arriving over a wire feed, one for notification data to be sent to
answering machines, an administrative interface implemented in a GUI, and
a database interface to get their subscriber data.
The people were struggling because they needed to add an http interface
from the weather service, an email interface to their subscribers, and they
had to find a way to bundle and unbundle their growing application suite for
different customer purchasing preferences. They feared they were staring at
a maintenance and testing nightmare as they had to implement, test and
maintain separate versions for all combinations and permutations.
Their shift in design was to architect the system’s interfaces ‘’by purpose’’
rather than by technology, and to have the technologies be substitutable (on
all sides) by adapters. They immediately picked up the ability to include the
http feed and the email notification (the new adapters are shown in the
drawing with dashed lines). By making each application executable in
headless mode through APIs, they could add an app-to-add adapter and
unbundle the application suite, connecting the sub-applications on demand.
Finally, by making each application executable completely in isolation, with
test and mock adapters in place, they gained the ability to regression test
their applications with stand-alone automated test scripts.
The current (2005) trend in web applications is to publish an API and let
other web applications access those APIs directly. Thus, it is possible to
publish local crime data over a Google map, or create web applications that
include Flickr’s photo archiving and annotating abilities.
All of these examples are about making the ‘’primary ‘’ports’ APIs visible. We
see no information here about the secondary ports.
Stored Outputs
This example written by Willem Bogaerts on the C2 wiki:
I did not like this at all. Then I came up with a solution: Have a presentation
control with storage facilities. Now the application no longer channels the
output in different directions, but it simply outputs it to the presentation
control. It’s the presentation control that buffers the answer and gives the
user the possibility to store it.
The traditional layered architecture stresses “UI” and “storage” to be
different. The Ports and Adapters Architecture can reduce output to being
simply “output” again. ”
Teams in different locations all build to the Hexagonal architecture, using FIT
and mocks so the applications or components can be tested in standalone
mode. The CruiseControl build runs every half hour and runs all the
applications using the FIT+mock combination. As application subsystem and
databases get completed, the mocks are replaced with test databases.
The application team creates FIT tests and mocks to isolate their application,
and creates testable, demonstrable functionality to show their users. When
the UI and back-end services decisions finally get met, it “should be
straightforward” to add those elements the application. Stay tuned to learn
how this works out (or try it yourself and write me to let me know).
Related Patterns
Adapter
The ‘’Design Patterns’’ book contains a description of the generic ‘’Adapter’’
pattern: “Convert the interface of a class into another interace clients
expect.” The ports-and-adapters pattern is a particular use of the ‘’Adapter’’
pattern.
Model-View-Controller
The MVC pattern was implemented as early as 1974 in the Smalltalk project. It
has been given, over the years, many variations, such as Model-Interactor
and Model-View-Presenter. Each of these implements the idea of ports-and-
adapters on the primary ports, not the secondary ports.
Pedestals
In “Patterns for Generating a Layered Architecture”, Barry Rubel describes a
pattern about creating an axis of symmetry in control software that is very
similar to ports and adapters. The ‘’Pedestal’’ pattern calls for implementing
an object representing each hardware device within the system, and linking
those objects together in a control layer. The ‘’Pedestal’’ pattern can be used
to describe either side of the hexagonal architecture, but does not yet stress
the similarity across adapters. Also, being written for a mechanical control
environment, it is not so easy to see how to apply the pattern to IT
applications.
Checks
Ward Cunningham’s pattern language for detecting and handling user input
errors, is good for error handling across the inner hexagon boundaries.
Acknowledgements
Thanks to Gyan Sharma at Intermountain Health Care for providing the
sample code used here. Thanks to Rebecca Wirfs-Brock for her book ‘’Object
Design’’, which when read together with the ‘’Adapter’’ pattern from the
‘’Design Patterns’’ book, helped me to understand what the hexagon was
about. Thanks also to the people on Ward’s wiki, who provided comments
about this pattern over the years (e.g., particularly Kevin Rutherford’s
http://silkandspinach.net/blog/2004/07/hexagonal_soup.html).
The ‘’Adapter’’ pattern: in Gamma, E., Helm, R., Johnson, R., Vlissides, J.,
‘’Design Patterns’’, Addison-Wesley, 1995, pp. 139-150.
Kevin Rutherford has started several notes and discussions around it:
Timo wrote a piece called Wrap it thinly about its use with TDD.
Success!
Problems with Smart Clients today
compile time vs runtime views
the use of symmetry in the hexagonal approach
Back to Hexagonal Architecture
some thoughts on the “Design Pattern” pattern
http://www.brianmandersen.com/blog/page/2/
https://github.com/totheralistair/SmallerWebHexagon
That one takes either browser, or Rack driver, or just a test driver on the left
side, and either a constant, or in-code, or from-a-file rate db on the right
side. I wrote this to show the implementation in a simple but real (2014)
setting.
http://tpierrain.blogspot.fr/2013/08/a-zoom-on-
hexagonalcleanonion.html
The slide show for the talk on this I gave at from Utah Code is
http://alistair.cockburn.us/Hexagonal+Architecture+Keynote+at+Utah+Code+Camp+September+2009.pps
also nice elaboration with notes for himself by Duncan Nisbet at
http://www.duncannisbet.co.uk/hexagonal-architecture-for-testers-
part-1
my video lightning talk at the Mountain West Ruby Conference in 2010:
Video of Alistairs hexagonal architecture CQRS lightning talk Mountain
West Ruby Conference 2010 (discussion: Re: Video of Alistairs
hexagonal architecture CQRS lightning talk Mountain West Ruby
Conference 2010)
https://twitter.com/search?q=%22hexagonal%20architecture%22
http://twitter.com/andrzejkrzywda/status/267420878487310336
(user-port only) a tiny CMS
https://github.com/totheralistair/SmallWebHexagon
https://github.com/patmaddox/hexarch2 Pat Maddox starts with a
Hexagonal Architecture and morphs it into Event Based and then CQRS.
Take a look.
Lovely long detailed discussion about hexagonal architecture and Rails
with BadrinathJanakiraman and Martin Fowler:
http://thoughtworks.wistia.com/medias/uxjb0lwrcz
detailed evolution at https://github.com/Lunch-
box/SimpleOrderRouting/wiki/Logbook-4#day-15-october-27th-2014
The difference between a primary and secondary actor lies only in who
initiates the conversation. A primary actor knows about and initiates the
conversation with the system or application; for a secondary actor, it is the
system or application that knows about and initiates the discussion with the
other. That is actually the only difference between the two, in use case land.
In the case of primary actor ports, the macro constructor will pass to the UI,
test framework, or driver the handle for the app and say, “Go talk to that”.
The primary actor will call into the app, and the app will probably never
know who called it. (That is normal for recipients of a call).
In stark contrast, for secondary actor ports, the macro constructor will pass
to the UI, test framework, or driver the handle for the secondary actor to be
used, that will get passed in as a parameter to the app, and the app will now
know who/what is the recipient of the outgoing call. (This is again normal for
sending out a call).
40 Comments
http://silkandspinach.net/2005/11/28/gravity-and-software-
adaptability
http://wordpress.com/tag/hexagonalarchitecture
http://silkandspinach.net/2005/05/23/databases-as-life-
support-for-domain-objects
http://silkandspinach.net/2004/07/16/hexagonal-soup
I’d like to add the Naked Objects pattern to the list of known uses.
The latest version, NO 4.0, also adds in the ability to exercise and
interact with the domain model using generic FitNesse fixtures. So
one can modify state, invoke actions, assert business rules and so
on. Again, no custom FitNesse coding is required.
For the persistence layer, NO has long had the ability to switch
between in-memory object store and other object stores (such as
a Hibernate-based one). We’ve found this immensely useful,
especially combined with the FitNesse stuff.
Cheers
Dan
Hey,
This is very problematic though: first of all the search field has to
know about the search result view, so they are coupled. If I then
also want to update some other part in the UI the search field has
to know about this too. Also, it is highly likely that once I get the
result, I have to query the application for other things in order to
present the result.
With hexagonal architecture this mess goes away. Since the flow is
only “in-out” rather than “up-down-up”, the application layer
method becomes:
Since the app layer uses() the UI layer, one of the observers just
happens to be the search result view, which presents the results. If
there had been a status bar it could have also consumed the
results and showed a message like “Found 14 matches”. Or more
like, a SearchStatus service would have Observed the search
results, which would have produced the string, which is then in
turn sent to StatusObservers, one of which happens to be the
status bar.
If the search takes a long time, the UI would be in trouble with the
first method, as it would essentially freeze when calling search.
With hexagonal architecture the search(string) method can accept
the string, return immediately, and then spawn off an
asynchronous search that only when completed notifies the
observers. The time between search and result can be quite long,
but the UI will still be responsive in between, without the UI
having to do the thread trickery. When consuming the results the
UI does, however, have to ensure that it is on the Swing thread.
In any case, a key point is that the search field does not have to
know how to present the results. All it does is take the string and
send it to the application for querying. What happens then is up to
the application and observers of the model that the processing
changes. Input and output are separated in code, but still both are
presented on the UI screen.
In this way there is only TELL, no ask. All events come from the
outside, goes to the inside (through app-domain), and then goes
out again. And sometimes the initiator (UI) just happens to be the
output too.
This would also simplify testing, as the call to the app and
introspection of the resulting model using a mock observer is
quite easy to do.
NEAT!
Rickard
Hi Alistair,
It is mentioned in this article that with mvc ports and adapter are
present for primary ports and not for secondary ports! how? Is it
like we have api’s for view in mvc. I am not getting this statement.
Is it possible to elaborate here with detail of your thoughts on
this?
Thanks,
Ak
cheers, Alistair
Hi Ak
I think that the point about MVC not really being a ports & adapter
pattern comes down to the fact that may implementations of MVC
allow a “fast-path” from the View to the Model, typically for bulk
data retrieval during population of of controls like lists and trees.
If you force all communication from the View to go to the
Controller and use the Controller as the single point of access to
the Model then I think you can argue that MVC can be a variation
on the ports & adapters pattern.
-by Jonathan on 4/14/2010 at 9:09 AM
Alistair,
If that’s right, let’s imagine a case where there are two consumers
of an app: (i) a UI, which is “the” UI for the app, and (ii) “other apps
in the business”, which will consume it using SOA-style services.
We are trying to decide between these two alternatives:
Do you see any strong reasons to choose one over the other?
Thanks for your reply Alistair. I suspect that in many cases, option
B is in fact done by combining the code for the port, plus the code
for the SOA adapter, into one thing called “the Service”. In my
current project, I think we’ll keep them separate and go with
Option A.
Thanks, Alistair!
Popped in to look for inspiration and, as per, found just what I was
looking for! Share the fascination with hexagonal structures in my
own “busy world,” but wasn’t sure how to apply it. Will add this
page to my links!
Domo!
Near the beginning you say “As events arrive from the outside
world at a port, a technology-specific adapter converts it into a
usable procedure call or message and passes it to the application.”
That makes it sound like an event from the outside world first hits
a port and is then processed by an adapter.
Alistair,
Hello Alister.
I’m quite happy to find out page with this kind of architecture
description.
After few small and big projects using J2EE stack I have started
private project. Besides others, objective was to develop more
flexible architecture. To be honest I’m surprised, the one I came up
with, is the same as described here. And has a name :-).
Code is far from state of the art and API is suboptimal, but all
authentication and multitenancy is actually working quite good. I
can confirm that compared to traditional J2EE development, I’m
not running into any major issues. Architecture is clean, flexible
and easy to hack.
Regards
Robert
Hi Alistair,
http://gabert.github.io
Robert
-by Robert on 12/18/2013 at 3:57 PM
Hello Alistair,
Or
-The hexagon
-One module per adapter, where each adapter depends on the
port of the hexagon that it implements.
Im I wrong?
Hello Alistair,
-The hexagon
-The out of the hexagon with all adpaters here.
Or
-The hexagon
-One module per adapter, where each adapter depends on the
port of the hexagon that it implements.
Im I wrong?
I’d like to know your thoughts on the subject. If you find the article
interesting you can link to it at:
http://ijsberg.org/documents/PESA_two_dimensional_layering.pdf
Best regards,
Jeroen Meetsma
http://www.dossier-
andreas.net/software_architecture/ports_and_adapters.html
greetings!
Patrick
thanks, Patrick. well done with the URL :). I also add here
the two other articles you reference: The birthday greetings
kata by Matteo Vaccariand Visualising Test Terminology by
Nat Price
Leave A Comment
Comment...
Save my name, email, and website in this browser for the next time I
comment.
four × 3 =
POST COMMENT
This site uses Akismet to reduce spam. Learn how your comment data is
processed.