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, others 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 ...

Get Node.js Design Patterns - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.