Hexagonal Architecture and the Netflix Use Case (Part 1)

Check out part 2 here

Hexagonal Architecture

Hexagonal Architecture (by Cloudnative.ly)

 

Hexagonal Architecture is a software architecture that allows independence between three parts of an application that most developers normally associate with: The User Side, The Business Logic, and the Server Side. Independence means that changes in each part would not affect the other. With the rise of platforms and microservices in software, Hexagonal Architecture is one of the popular architectures among engineers due to its flexibility in changing or adding platforms/microservices of an application without hurting Business Logic. We will see later in the Netflix Use Case.

 

Structure of Hexagonal Architecture

  • Business Logic: Handles the complex business rules of the applications
  • User Side: user and external programs that will interact with the application
  • Server Side: infrastructures like libraries, databases that will help the Business Logic when needed
  • Port: interfaces that isolate and allow interaction between Business Logic and User/Server. Ports are usually implemented in the Business Logic
  • Adapter: Implementation of Port that is required by any User/Server who would want to connect with the Business Logic
  • Primary Port: Port for User-Side
  • Secondary Port: Port for Server-Side
Hexagonal Architecture (by Blog Octo)

Principle of Hexagonal Architecture

  • Explicitly separate User-side, Business Logic, and Server-side => Develop the three parts independently while keeping in mind the information each layer needed from the others to make it functional
  • Dependencies (User/Server) goes inside the Business Logic => Isolate the Business Logic from the dependencies so that even when the User-Side or Server-side changes, the business core will not
  • Isolating the boundaries with Ports-and-Adapters => Ports are contracts from the Business Logic require the User/Server to comply to communicate, even when those dependencies are changeable. Adapters are implementations of the Ports from the User/Server sides so that incoming requests/data from both sides come into the Business Logic in a correct format.

Sources:

[1]: Alliaume, E., & Roccaserra, S. (n.d.). Hexagonal Architecture: Three principles and an implementation example. Retrieved October 09, 2020, from https://blog.octo.com/en/hexagonal-architecture-three-principles-and-an-implementation-example/

[2]: Dodd, B. (2020, March 27). Hexagonal Architecture. Retrieved October 09, 2020, from https://cloudnative.ly/hexagonal-architecture-534d2c425360

Add a Comment

Your email address will not be published.