Skip to main content

Enterprise Design Patterns

Layered Architecture MV(x)​

Model-View-Controller (MVC)

Model-View-Presenter (MVP)

Model-View-Intent (MVI)

Model-View-ViewModel (MVVM)

Model-View-ViewModel-Coordinator (MVVM-C)

View-Interactor-Presenter-Entity-Router (VIPER)

Domain-Driven Design (DDD)​

  • Communication: Enhances communication among developers, managers, and domain experts through a shared language and understanding of the business domain
  • Productivity: Boosts productivity with a clear comprehension of the business domain and by encapsulating domain logic in an easily understandable and maintainable manner
  • Improved Maintainability: Enhances maintainability via a modular, object-oriented design that facilitates understanding and modification
  • Scalability: Enhances scalability by breaking down large monolithic applications into smaller, more manageable components
  • Flexibility: Enhances flexibility by facilitating the handling of complex business processes and adapting to changing business requirements

Hexagonal Architecture​

Hexagonal architecture, also known as ports and adapters architecture, is an architectural pattern that aims to create loosely coupled application components that can be easily connected to their software environment by means of ports and adapters. This makes components exchangeable at any level and facilitates test automation.

Hexagonal Architecture's concept is to position inputs and outputs on the periphery of the design. The business logic should remain unaffected regardless of whether we expose a REST or a GraphQL API, and irrespective of our data sources — be it a database, a microservice API revealed through gRPC or REST.

Port

A port is an interface that facilitates communication between an application and an external system using a specific protocol. It can be either incoming (receiving requests or events from the external system) or outgoing (sending commands or queries to the external system).

A port can support multiple adapters, each implementing the communication protocol differently. For instance, an incoming port could have adapters for a GUI, CLI, or a web service, while an outgoing port could have adapters for various DBMS or repositories.

Adapters

An adapter is a component that links a port to an external system, translating data and messages between the application and the external system using the port's protocol. It also manages technical aspects like error handling, logging, security, and caching.

Depending on the role of the external system, an adapter can be primary (connecting to an actor initiating communication) or secondary (connecting to an actor responding to communication). Primary actors include users or other applications, while secondary actors include databases or services.