PrepZone Logo
PrepZone

Middleware Chain of Responsibility

Compose cross-cutting concerns as a pipeline.

Why this matters

  • Handler interface — detailed pointwise breakdown in the section below.
  • Auth then rate-limit — detailed pointwise breakdown in the section below.
  • Ordering — detailed pointwise breakdown in the section below.
  • CampusOS API gateway — detailed pointwise breakdown in the section below.
  • Production Java structure interviewers expect in backend LLD.
Request
Auth
Validate
Handler
Request passes through ordered handlers before reaching the core handler.

Overview

Compose cross-cutting concerns as a pipeline. Study each section below in order — every list is interview-ready reference material.

Handler interface

Points to cover

  • Definition — what Handler interface 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

Auth then rate-limit

Points to cover

  • Definition — what Auth then rate-limit 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

Ordering

Points to cover

  • Definition — what Ordering 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

CampusOS API gateway

Points to cover

  • Definition — what CampusOS API gateway 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 "Handler interface" on paper first, then in code
public final class MiddlewareChainExample {
    // 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. Handler interface — review this slice before mock interviews.
  2. Auth then rate-limit — review this slice before mock interviews.
  3. Ordering — review this slice before mock interviews.
  4. CampusOS API gateway — review this slice before mock interviews.

Test yourself

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