CS FundamentalsHardProduct-company design interview

In a hexagonal (ports-and-adapters) architecture, the order-processing core defines an interface OrderRepository, implemented by a PostgresOrderRepository in an outer layer, and a REST controller calls the core through an input port. Which benefit is the main goal?

  1. A. The core business logic depends on no framework, database or UI, so it can be tested with in-memory adapters and the infrastructure can be swapped
  2. B. It guarantees faster database queries
  3. C. It removes the need for interfaces
  4. D. It makes the REST controller contain the business rules

Correct answer: A. The core business logic depends on no framework, database or UI, so it can be tested with in-memory adapters and the infrastructure can be swapped

Dependencies point inwards: adapters depend on ports defined by the core, an application of dependency inversion. Business rules stay isolated from technology choices and are easy to unit-test.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic