Command Pattern in JavaScript

While reading the brilliant book by Addy Osmani, Learning JavaScript Design Patterns, I’ve ran into the Command Pattern. Before any further reading, I’ve turned to the book, Design Patterns: Elements of Reusable Object-Oriented Software. After reading the chapter on Command Pattern, it reminded me a lot of Redux.js and how its actions work. Actions in Redux are just plain old JavaScript objects that contains a “command” and optional data. I was so certain they were related that I googled “Command Pattern and Redux” and found this article titled Redux and The Command Pattern It’s fascinating how even new technology created in the last few years still have roots in tried and true design patterns. Just reinforces the fact that every software developer should have a solid understanding of design patterns.

Written on January 4, 2021