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.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A practical, modern guide for JavaScript and React developers who want to write cleaner, more maintainable code by applying classic design patterns—from modules and observers to server-side rendering and Islands architecture—with clear explanations of when and why to use each approach.
【Book Arc】
- **Opening (~0%–25%)**: Introduces the core philosophy of design patterns—what they are, why they matter, and how they evolved from architecture into software—plus the "Rule of Three" for validating a pattern and the dangers of anti-patterns. This stage sets the conceptual foundation before any code.
- **Early (~25%–50%)**: Covers modern JavaScript syntax and features that make patterns practical today, including ES modules (static and dynamic imports), classes with constructors/getters/setters, and the importance of decoupling applications. This is the language-level toolkit you'll need for the rest of the book.
- **Middle (~50%–75%)**: Dives into the three classic pattern categories—creational, structural, and behavioral—with detailed walkthroughs of specific patterns like Constructor, Module, Singleton, Prototype, and Factory, including their advantages, disadvantages, and React-specific applications like state management.
- **Late (~75%–100%)**: Moves into advanced and modern territory: rendering patterns (server-side rendering, hydration, Islands architecture), performance patterns (dynamic imports, code-splitting), and architectural patterns (MVC, MVP, MVVM) from a modern web developer's perspective, plus React-specific patterns like Hooks and higher-order components.
【Key Takeaways】
- **Design patterns are proven solutions, not rigid rules** (Opening): A pattern must pass the "Rule of Three"—it should solve a recurring problem in a reusable way—and proto-patterns need testing before adoption. This helps you avoid cargo-culting patterns that don't fit your problem.
- **Anti-patterns are just as important to learn as patterns** (Opening): Recognizing common JavaScript anti-patterns (like polluting the global scope or over-nesting callbacks) prevents you from writing code that looks structured but is actually fragile. Knowing what *not* to do sharpens your judgment.
- **Modern ES modules are the backbone of decoupled applications** (Early): Static imports for predictable dependencies, dynamic imports for on-demand loading (on interaction or visibility), and module objects for organization—these features make patterns like Module and Factory far more powerful than in older JavaScript.
- **Creational patterns solve object-creation problems** (Middle): The Constructor, Module, Singleton, Prototype, and Factory patterns each offer a different trade-off between flexibility, memory usage, and encapsulation. For example, the Module pattern with WeakMap provides true privacy, while the Factory pattern is ideal when you don't know the exact object type ahead of time.
- **Structural and behavioral patterns shape how components interact** (Middle): Patterns like Mixins, Observers, and Mediators help you manage relationships between objects—whether you're sharing behavior, notifying dependents of changes, or centralizing communication—which is critical for scaling React component trees.
- **Rendering patterns are the new frontier for performance** (Late): Server-side rendering, hydration, and Islands architecture each solve different trade-offs between initial load time, interactivity, and SEO. Choosing the right rendering strategy is now as important as choosing the right design pattern.
- **Performance patterns like dynamic imports and code-splitting are essential** (Late): Loading code only when needed—on user interaction or when a component becomes visible—dramatically reduces bundle size and improves perceived performance, especially for large React applications.
- **Architectural patterns (MVC, MVP, MVVM) still matter in modern web apps** (Late): Even with React's component model, understanding how to separate concerns—data, presentation, and logic—helps you structure apps that are testable and maintainable at scale.
【Reading Tips】
- **Skim the first two chapters** if you're already familiar with design patterns from other languages; the history and "Rule of Three" are useful context but not essential for the code-heavy chapters that follow.
- **Deep-read Chapter 5 (Modern JavaScript Syntax)** before anything else—it's the prerequisite for understanding how patterns are implemented today. Pay special attention to dynamic imports and module objects, as they reappear throughout the book.
- **Treat the pattern chapters as a reference, not a novel**: Each pattern (Module, Singleton, Factory, etc.) follows a consistent structure—definition, implementation, pros/cons, when to use. Jump to the pattern you need rather than reading linearly.
- **Focus on the "When to Use / When Not to Use" sections** for each pattern—this is where Osmani's practical experience shines. The code examples are illustrative, but the decision frameworks are what you'll actually apply on the job.
- **For React developers, prioritize the React-specific sections** (like state management in the Singleton chapter and Hooks/HOCs later) over the vanilla JavaScript implementations, since those show how patterns translate to your daily work.
【Coverage Limits】
The excerpts cover the book's front matter, table of contents, and early chapters (through Chapter 7's creational patterns). Detailed content on structural/behavioral patterns, rendering patterns, and React-specific patterns (Hooks, HOCs, Islands) is referenced in the TOC but not fully excerpted here.
Excerpt 1
书名: Learning JavaScript Design Patterns A JavaScript and React Developer’s Guide (Addy Osmani) (Z-Library) 作者: Addy Osmani Do you want to write beautiful, st...
c to developers applying systems thinking to their own work. Any developer reading this book will see incredible returns on the time investment reading it.” ...
to stay ahead in the ever-evolving world of web development. Addy Osmani is an engineering leader for Google, where he leads the Chrome developer experience ...
se of the author and do not represent the publisher’s views. While the publisher and the author have used good faith efforts to ensure that the information a...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Learning JavaScript Design Patterns A JavaScript and React Developer’s Guide (Addy Osmani) (Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Learning JavaScript Design Patterns A JavaScript and React Developer’s Guide (Addy Osmani) (Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment