PrepZone Logo
PrepZone

CQRS and Event Sourcing Intro

When to split read and write models in LLD discussions.

Read these first

Why this matters

  • Command vs query — detailed pointwise breakdown in the section below.
  • Projections — detailed pointwise breakdown in the section below.
  • Event store sketch — detailed pointwise breakdown in the section below.
  • When not to — detailed pointwise breakdown in the section below.
  • Games and architecture patterns signal staff+ depth.
Command
Event storeAppend-only log
Read projection
Commands write events; projections build read models from the log.

Overview

When to split read and write models in LLD discussions. Study each section below in order — every list is interview-ready reference material.

Command vs query

Points to cover

  • Definition — what Command vs query 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

Projections

Points to cover

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

Event store sketch

Points to cover

  • Definition — what Event store sketch 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

When not to

Points to cover

  • Definition — what When not to 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 "Command vs query" on paper first, then in code
public final class CqrsEventSourcingIntroExample {
    // 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. Command vs query — review this slice before mock interviews.
  2. Projections — review this slice before mock interviews.
  3. Event store sketch — review this slice before mock interviews.
  4. When not to — review this slice before mock interviews.

Test yourself

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