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 this architectural styles, up to certain extent we were able to decouple the domain logic with other functionalities. At times the domain logic use 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 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 outside request into a compatible one. The core and the adapters sits as inner layer. The ports sits on outer layer to interact with the external services. The below diagram depicts the above said architectural style.
The advantages of this style is the core logic abstracted from the out side 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 micro services architectural style? and what are the driving factors behind it? Till then Stay Tune!!!