Sobes.tech
Junior — Middle

Kas saaksite selgitada kuupsedala arhitektuuri kontseptsiooni ja selle põhialuseid?

sobes.tech AI

Vastus AI-lt

Hexagonal architecture (or Ports and Adapters) is an approach to application design that separates business logic from external dependencies.

Main principles:

  • The center of the architecture is the business logic (core), independent of external systems.
  • Around the core are ports — interfaces through which the core interacts with the outside world.
  • Adapters implement these ports and provide connections to databases, UI, external services.

This allows easy replacement of external components without changing business logic and simplifies testing.

Example:

  • The core describes an interface for storing data (port).
  • The adapter implements this interface, for example, via a database.
  • When changing the database, only the adapter changes, the core remains unchanged.