O'Reilly logo

Design Patterns in Modern C++: Reusable Approaches for Object-Oriented Software Design by Dmitri Nesteruk

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Dmitri Nesteruk 2018

Dmitri Nesteruk, Design Patterns in Modern C++, https://doi.org/10.1007/978-1-4842-3603-1_14

14. Command

Dmitri Nesteruk

(1)St. Petersburg, Russia

Think about a trivial variable assignment, such as meaning_of_life = 42. The variable got assigned, but there’s no record anywhere that the assignment took place. Nobody can give us the previous value. We cannot take the fact of assignment and serialize it somewhere. This is problematic, because without a record of the change, we are unable to roll back to previous values, perform audits, or do history-based debugging.1

The Command design pattern proposes that, instead of working with objects directly by manipulating them through their APIs, we send them commands: instructions on ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required