Layered architecture is a common architectural pattern for organising application components into distinct technical layers – presentation, application, business, persistence, etc
The separation of concerns between components is the most powerful feature of layered architecture.
The problem with layered architecture is that because the application architecture is 𝘴𝘦𝘨𝘳𝘦𝘨𝘢𝘵𝘦𝘥 𝘷𝘪𝘢 𝘵𝘦𝘤𝘩𝘯𝘪𝘤𝘢𝘭 𝘭𝘢𝘺𝘦𝘳𝘴, there is no clear concept of the domain dimension.
To change a certain feature developers generally need to change code in multiple layers as the functionality is spread among different layers.
A better alternative to layered architecture is 𝗵𝗲𝘅𝗮𝗴𝗼𝗻𝗮𝗹 𝗮𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲, also called 𝗽𝗼𝗿𝘁𝘀 𝗮𝗻𝗱 𝗮𝗱𝗮𝗽𝘁𝗲𝗿𝘀 𝗮𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗲. With hexagonal architecture the application architecture is 𝘴𝘦𝘨𝘳𝘦𝘨𝘢𝘵𝘦𝘥 𝘷𝘪𝘢 𝘣𝘶𝘴𝘪𝘯𝘦𝘴𝘴 𝘥𝘰𝘮𝘢𝘪𝘯.
The hexagonal architecture divides a system into several loosely-coupled interchangeable components, such as the application core, the database, the UI, test and interfaces with other systems.
𝗧𝗵𝗲 𝗺𝗮𝗶𝗻 𝗽𝗿𝗶𝗻𝗰𝗶𝗽𝗹𝗲 𝗼𝗳 𝗵𝗲𝘅𝗮𝗴𝗼𝗻𝗮𝗹 𝗼𝗿 𝗽𝗼𝗿𝘁𝘀 𝗮𝗻𝗱 𝗮𝗱𝗮𝗽𝘁𝗲𝗿𝘀 𝗮𝗿𝗰𝗵𝗶𝘁𝗲𝗰𝘁𝘂𝗿𝗮𝗹 𝗽𝗮𝘁𝘁𝗲𝗿𝗻 𝗶𝘀 𝘁𝗵𝗮𝘁 𝘆𝗼𝘂𝗿 𝗯𝘂𝘀𝗶𝗻𝗲𝘀𝘀 𝗹𝗼𝗴𝗶𝗰 – 𝘁𝗵𝗲 𝗵𝗲𝘅𝗮𝗴𝗼𝗻 – 𝗶𝘀 𝗽𝗿𝗼𝘁𝗲𝗰𝘁𝗲𝗱 𝗮𝗻𝗱 𝗰𝗮𝗻 𝗼𝗻𝗹𝘆 𝗰𝗼𝗺𝗺𝘂𝗻𝗶𝗰𝗮𝘁𝗲 𝘄𝗶𝘁𝗵 𝘁𝗵𝗲 𝗼𝘂𝘁𝘀𝗶𝗱𝗲 𝘄𝗼𝗿𝗹𝗱 𝘃𝗶𝗮 𝗶𝗻𝘁𝗲𝗿𝗳𝗮𝗰𝗲𝘀 – 𝘁𝗵𝗲 𝗽𝗼𝗿𝘁𝘀 – 𝘁𝗵𝗮𝘁 𝗮𝗿𝗲 𝘁𝗵𝗲𝗻 𝗶𝗺𝗽𝗹𝗲𝗺𝗲𝗻𝘁𝗲𝗱 𝗶𝗻 𝘆𝗼𝘂𝗿 𝘁𝗲𝗰𝗵𝗻𝗼𝗹𝗼𝗴𝘆 𝗼𝗳 𝗰𝗵𝗼𝗶𝗰𝗲, 𝘁𝗵𝗲 𝗮𝗱𝗮𝗽𝘁𝗲𝗿𝘀.