JavaScript Patterns
Reusable JavaScript concurrency and error-handling patterns.
All Articles (5 articles)
-
Publish-Subscribe Pattern in JavaScript
Programming & Patterns / JavaScript Patterns 12 min readArchitectural principles, implementation trade-offs, and production patterns for event-driven systems. Covers the three decoupling dimensions, subscriber ordering guarantees, error isolation strategies, and when Pub/Sub is the wrong choice.
-
Exponential Backoff and Retry Strategy
Programming & Patterns / JavaScript Patterns 17 min readLearn how to build resilient distributed systems using exponential backoff, jitter, and modern retry strategies to handle transient failures and prevent cascading outages.
-
Async Queue Pattern in JavaScript
Programming & Patterns / JavaScript Patterns 13 min readBuild resilient, scalable asynchronous task processing systems—from basic in-memory queues to advanced distributed patterns—using Node.js. This article covers the design reasoning behind queue architectures, concurrency control mechanisms, and resilience patterns for production systems.
-
JavaScript Error Handling Patterns
Programming & Patterns / JavaScript Patterns 21 min readMaster exception-based and value-based error handling approaches, from traditional try-catch patterns to modern functional programming techniques with monadic structures.
-
JavaScript String Length: Graphemes, UTF-16, and Unicode
Programming & Patterns / JavaScript Patterns 13 min readJavaScript’s string.length returns UTF-16 code units—a 1995 design decision that predates Unicode’s expansion beyond 65,536 characters. This causes '👨👩👧👦'.length to return 11 instead of 1, breaking character counting, truncation, and cursor positioning for any text containing emoji, combining marks, or supplementary plane characters. Understanding the three abstraction layers—grapheme clusters, code points, and code units—is essential for correct Unicode handling.