Summary
In this chapter, we learned how some of the traditional GoF design patterns can be applied to JavaScript and, in particular, to the Node.js philosophy. Some of them were transformed, some were simplified, other renamed or adapted as part of their assimilation by the language, the platform, and the community. We emphasized how simple patterns such as Factory can greatly improve the flexibility of our code and how with Proxy, Decorator, and Adapter we can manipulate, extend, and adapt the interface of existing objects. Strategy, State, and Template, instead, have shown us how to split a bigger algorithm into its static and variable parts, allowing us to improve the code reuse and extensibility of our components. By learning the Middleware pattern, we are now able to process our data using a simple, extensible, and elegant paradigm. Finally, the Command pattern provided us with a simple abstraction to make any operation more flexible and powerful.
We also acquired other evidence of how...