/CommandPattern

Head First Design Patterns - Chapter 6 - The Command Pattern

Primary LanguageJava

The Command Pattern

Encapsulates a request as an object, thereby letting you parameterize other objects with different requests, queue or log requests, and support undoable operations.

OO Principles

  • Encapsulate what varies.
  • Favor composition over inheritance.
  • Program to interfaces, not implementations.
  • Strive for loosely coupled designs between objects that interact.
  • Classes should be open for extension but closed for modification.
  • Depend on abstractions. Do not depend on concrete classes.