PrepZone Logo
PrepZone

Hexagonal Architecture

Ports define needs; adapters provide technology.

Why this matters

  • Ports — detailed pointwise breakdown in the section below.
  • Adapters — detailed pointwise breakdown in the section below.
  • Payment example — detailed pointwise breakdown in the section below.
  • Testing — detailed pointwise breakdown in the section below.
  • Games and architecture patterns signal staff+ depth.
Application core
Driving adaptersREST, CLI
Domain + ports
Driven adaptersDB, messaging
Domain at the centre; ports define interfaces; adapters plug in infrastructure.

Overview

Ports define needs; adapters provide technology. Study each section below in order — every list is interview-ready reference material.

Ports

Points to cover

  • Definition — what Ports means in one clear sentence
  • When to use — the force or smell that triggers this concept
  • CampusOS example — where this appears in parking, booking, or library modules
  • How to explain — pointwise bullets you can say aloud in an interview
  • Common mistake — what weak candidates do instead
  • Refactor move — one concrete change that improves the design

Adapters

Points to cover

  • Definition — what Adapters means in one clear sentence
  • When to use — the force or smell that triggers this concept
  • CampusOS example — where this appears in parking, booking, or library modules
  • How to explain — pointwise bullets you can say aloud in an interview
  • Common mistake — what weak candidates do instead
  • Refactor move — one concrete change that improves the design

Payment example

Points to cover

  • Definition — what Payment example means in one clear sentence
  • When to use — the force or smell that triggers this concept
  • CampusOS example — where this appears in parking, booking, or library modules
  • How to explain — pointwise bullets you can say aloud in an interview
  • Common mistake — what weak candidates do instead
  • Refactor move — one concrete change that improves the design

Testing

Points to cover

  • Definition — what Testing means in one clear sentence
  • When to use — the force or smell that triggers this concept
  • CampusOS example — where this appears in parking, booking, or library modules
  • How to explain — pointwise bullets you can say aloud in an interview
  • Common mistake — what weak candidates do instead
  • Refactor move — one concrete change that improves the design
Java
// CampusOS — apply "Ports" on paper first, then in code
public final class HexagonalPortsAdaptersExample {
    // 1. Name entities from the problem statement
    // 2. Draw relationships before writing methods
    // 3. Introduce patterns only when a force appears
}

Quick recall

Everything you need if you only revisit this box.

  1. Ports — review this slice before mock interviews.
  2. Adapters — review this slice before mock interviews.
  3. Payment example — review this slice before mock interviews.
  4. Testing — review this slice before mock interviews.

Test yourself

Answer these before moving on — recall is what makes it stick.