Skip to main content
PreparationZone Logo
PrepZone

Command and Undo

Encapsulate requests as objects for queues, logging, and undo stacks.

Pass checkpoint below

Read these first

Why this matters

  • Command interface — detailed pointwise breakdown in the section below.
  • Invoker — detailed pointwise breakdown in the section below.
  • Undo stack — detailed pointwise breakdown in the section below.
  • CampusOS editor — detailed pointwise breakdown in the section below.
  • Patterns are forces and solutions — name the force before the pattern.
Invoker
Commandexecute() / undo()
Receiver
Encapsulate requests as objects — enables undo, queue, and logging.

Overview

Encapsulate requests as objects for queues, logging, and undo stacks. Study each section below in order — every list is interview-ready reference material.

Command interface

Points to cover

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

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 3 sections

  • Invoker
  • Undo stack
  • CampusOS editor

Test yourself

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