group is at a particular level of abstraction 3 M. Fowler, Patterns of Enterprise Application Architecture, Addison-Wesley Longman Publishing (2002) Layer Responsibilities Presentation Provision of services, display of information Domain Logic that is the real point of the system Data Source Communication with databases, messaging systems Three principal layers
Web applications B. Doyle and C. V. Lopes, Survey of Technologies for Web Application Development, CoRR, abs/0801.2618 (2008) Java Virtual Machine (JVM) Java 2, Standard Edition(J2SE) J2EE Services and Interfaces (Data Source) JDNI JDBC JTS JMS JCA JAAS EJB Container(Domain) EJB Components Java Classes Web Container (Presentation) Java Servlets Java Servlet Pages (JSP)
Source Domain Presentation User Crawler Interaction with clients A. Cockburn, Hexagonal architecture, http://alistair.cockburn.us/Hexagonal+architecture
source layers are about connection to the outside world Interaction with external entities Data Source Domain Presentation User Crawler Internal RDB Cloud SQL A. Cockburn, Hexagonal architecture, http://alistair.cockburn.us/Hexagonal+architecture
a core surrounded by interfaces to external systems A. Cockburn, Hexagonal architecture, http://alistair.cockburn.us/Hexagonal+architecture Application User-side API Database Message Service User Crawler SQS Google Cloud Pub/Sub Cloud SQL RDB
an application to be developed and tested in isolation from its external entities Adapters convert events into usable messages and pass them to the application Adapter1 +response +getMessage Adapter2 +receive +getMessage Port +getMessage Event2 +response Event1 +receive Application boundary Internal classes A. Cockburn, Hexagonal architecture, http://alistair.cockburn.us/Hexagonal+architecture
layers J. Palermo, The Onion Architecture, http://jeffreypalermo.com/blog/the-onion-architecture-part-3/ Each layer is often coupled to the layers below it Data Source Business Logic UI Dependencies
center, and the outer layer is reserved for things that change often Domain Model Object Services Application Services Tests Infrastructure UI Dependencies J. Palermo, The Onion Architecture, http://jeffreypalermo.com/blog/the-onion-architecture-part-3/
layer Any outer layer can directly call any inner layer Domain Model Object Services Application Services Tests Infrastructure UI IUserSession J. Palermo, The Onion Architecture, http://jeffreypalermo.com/blog/the-onion-architecture-part-3/
be mentioned by an inner circle R. C. Martin, The Clean Architecture, https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html The Clean Architecture Entities Use Cases Frameworks & Drivers Interface Adapters Database Row Entity IUserSession We don’t cheat and pass entities or database rows across the boundaries
Transfer objects are passed across the boundaries The Clean Architecture Entities Use Cases Frameworks & Drivers Interface Adapters Use Case Adapter passes isolated, simple data structures R. C. Martin, The Clean Architecture, https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html
• Use Cases contain application specific business rules • Interface Adapters convert data from some external form to the form used by the use cases and entities • Frameworks and Drivers composed of frameworks and tools such as the Database, the Web Framework, etc R. C. Martin, The Clean Architecture, https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html
to other services Any small changes require the entire monolith to be rebuilt and deployed J. Lewis and F. Martin, Microservices, https://martinfowler.com/articles/microservices.html single instance of an application server Service A Service B tightly coupled
running instances behind a load balancer Scaling requires scaling of the entire application rather than parts of it that require greater resource J. Lewis and F. Martin, Microservices, https://martinfowler.com/articles/microservices.html requires greater resource Service A Service B Service A Service B Service A Service B wasteful scaling
distributed systems which breaks down an application into services Service is a unit of software that is independently replaceable and upgradeable DB Search scaling Product Load Balancer J. Lewis and F. Martin, Microservices, https://martinfowler.com/articles/microservices.html Load Balancer DB Product DB DB Search Search Load Balancer Load Balancer service communicating with an out-of-process mechanism
Shared nothing system scales to a large number of machies J. Bonér, Reactive Microservices Architecture, O’Reilly Media, Inc., (2016) Load Balancer DB Search Search Product DB It does not matter to which instance a particular request is sent
within the event driven context Provides stateless containers that are ephemeral, event-triggered, and fully managed by a 3rd party Client Request handle function 3rd-party service DB Click stateless container M. Fowler, Serverless Architectures, https://martinfowler.com/articles/serverless.html
on 3rd party services or on FaaS M. Fowler, Serverless Architectures, https://martinfowler.com/articles/serverless.html Client API gateway purchase search DB DB authentication service functions request
by the provider M. Fowler, Serverless Architectures, https://martinfowler.com/articles/serverless.html Scaling managed by the provider Client API gateway purchase search DB DB authentication service request request request search search purchase purchase
be designed so that they can tolerate the failure of services J. Bonér, Reactive Microservices Architecture, O’Reilly Media, Inc., (2016) Client Service A Service B Service C requires responses from B and C
is required to decouple them in time and space Client message broker Service Service asynchronous boundary J. Bonér, Reactive Microservices Architecture, O’Reilly Media, Inc. (2016) A. Tanenbaum, Distributed Systems: Principles and Paradigms, Createspace Independent Publishing Platform (2016) Time: allowing concurrency Space: hiding where a resource is located
failure can be achieved using asynchronous message-passing J. Bonér, Reactive Microservices Architecture, O’Reilly Media, Inc., (2016) message broker Op1 Thread Time Op2 Service Service asynchronous boundary Service Op3 Op1 Service
elasticity, and responsiveness The Reactive Manifesto, http://www.reactivemanifesto.org/ The reactive manifesto Responsive Elastic Resilient Message Driven A B A forms the basis for B