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?
- 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
- B. It guarantees faster database queries
- C. It removes the need for interfaces
- 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.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A module handleIO(kind, data) contains one big switch: kind 1 reads from the keyboard, kind 2 writes a file, kind 3 sends a network…
- For integer variables, what is the weakest precondition wp(x := x + 1; y := 2 x, y > 10)?
- Which Hoare triple is valid for integer variables (partial correctness)?
- This loop sums an array: python i = 0; s = 0 while i < n: s = s + a[i] i = i + 1 Which assertion is a loop invariant (true every time the…
- Two identical servers run in parallel (the system works while at least one does). Each fails independently with an exponential failure…
- A team fits the Goel–Okumoto reliability-growth model μ(t) = a(1 − e^(−bt)) to its test data, with a = 120 expected total faults and b =…