In this article, we will see “Hexagonal Architectural Pattern” also known as “Ports and Adapters” pattern. As developers so far we have created applications with tiered architecture styles like MVC (Model View Controller). With these architectural styles, up to a certain extent, we were able to decouple the domain logic with other functionalities. At times the domain logic uses to leak into UI or other functionalities. As the core logic is getting leaked into other layers, the impact of the code change will have a ripple effect on other modules. To avoid this we can go with “Ports and Adapters” architecture style.
The “Ports and Adapters” style will have domain logic as Core and the Adapters will have the application logic specific to translate an interface from the outside request into a compatible one. The core and the adapters sit as the inner layer. The ports sit on the outer layer to interact with the external services. The below diagram depicts the above said architectural style.
The advantages of this style are the core logic abstracted from the outside world. The code is decoupled via the adapters. We can add or remove the new functionalities easily. We can perform testing of core logic and the adapters in isolation mode.
In the coming article, we will see what is microservices architectural style? and what are the driving factors behind it? Till then Stay Tune!!!