Book description
Do you want to write beautiful, structured, and maintainable JavaScript by applying modern design patterns to the language? Do you want clean, efficient, manageable code? Want to stay up-to-date with the latest best practices? If so, the updated second edition of Learning JavaScript Design Patterns is the ideal place to start.
Author Addy Osmani shows you how to apply modern design patterns to JavaScript and React—including modules, mixins, observers, and mediators. You'll learn about performance and rendering patterns such as server-side rendering and Islands architecture. You'll also learn how architectural patterns like MVC, MVP, and MVVM are useful from the perspective of a modern web application developer.
This book explores:
- Architectural patterns for structuring your components and apps
- More than 20 design patterns in JavaScript and React, applicable for developers at any level
- Different pattern categories including creational, structural, and behavioral
- Essential performance patterns including dynamic imports and code-splitting
- Rendering patterns such as server-side rendering, hydration, Islands architecture, and more
Additionally, you'll explore modern JavaScript syntax like JavaScript modules, React patterns like Hooks, higher-order components (HOCs), and more, to stay ahead in the ever-evolving world of web development.
Publisher resources
Table of contents
- Preface
- 1. Introduction to Design Patterns
- 2. “Pattern”-ity Testing, Proto-Patterns, and the Rule of Three
- 3. Structuring and Writing Patterns
- 4. Anti-Patterns
-
5. Modern JavaScript Syntax and Features
- The Importance of Decoupling Applications
- Modules with Imports and Exports
- Module Objects
- Modules Loaded from Remote Sources
- Static Imports
- Dynamic Imports
- Modules for the Server
- Advantages of Using Modules
- Classes with Constructors, Getters, and Setters
- Classes in JavaScript Frameworks
- Summary
- Related Reading
- 6. Categories of Design Patterns
-
7. JavaScript Design Patterns
- Creational Patterns
- The Constructor Pattern
- The Module Pattern
- The Revealing Module Pattern
- The Singleton Pattern
- The Prototype Pattern
- The Factory Pattern
- Structural Patterns
- The Facade Pattern
- The Mixin Pattern
- Subclassing
- Mixins
- The Decorator Pattern
- Pseudoclassical Decorators
- Advantages and Disadvantages
- Flyweight
- Behavioral Patterns
- The Observer Pattern
- The Mediator Pattern
- The Command Pattern
- Summary
- 8. JavaScript MV* Patterns
-
9. Asynchronous Programming Patterns
- Asynchronous Programming
- Background
- Promise Patterns
- async/await Patterns
-
Additional Practical Examples
- Making an HTTP Request
- Reading a File from the Filesystem
- Writing to a File on the Filesystem
- Executing Multiple async Operations
- Executing Multiple async Operations in Sequence
- Caching the Result of an async Operation
- Handling Events with async/await
- Retrying an async Operation on Failure
- Creating an async/await Decorator
- Summary
- 10. Modular JavaScript Design Patterns
- 11. Namespacing Patterns
- 12. React.js Design Patterns
- 13. Rendering Patterns
- 14. Application Structure for React.js
- 15. Conclusions
- Appendix. References
- Index
- About the Author
Product information
- Title: Learning JavaScript Design Patterns, 2nd Edition
- Author(s):
- Release date: April 2023
- Publisher(s): O'Reilly Media, Inc.
- ISBN: 9781098139872
You might also like
book
Learning JavaScript Design Patterns
With Learning JavaScript Design Patterns, you’ll learn how to write beautiful, structured, and maintainable JavaScript by …
book
JavaScript: The Definitive Guide, 7th Edition
JavaScript is the programming language of the web and is used by more software developers today …
video
Modern JavaScript From The Beginning
This is a front to back JavaScript course for absolutely everybody. We start with the basic …
book
Node.js Design Patterns - Third Edition
Learn proven patterns, techniques, and tricks to take full advantage of the Node.js platform. Master well-known …