async

Promises and async/await patterns for asynchronous JavaScript

Promises represent eventual completion or failure of asynchronous operations. I create promises with new Promise((resolve, reject) => {}) executor function. The .then() method chains successful results while .catch() handles errors. Using .finally(

Fetch API for HTTP requests and AJAX communication

The Fetch API provides modern interface for HTTP requests returning promises. I use fetch(url) to make GET requests that resolve with Response objects. The response.json() parses JSON data asynchronously. POST requests need method, headers, and body o

Pin and Unpin for safe self-referential async futures

Pin ensures that a value won't move in memory, which is required for self-referential types like async futures. Most async code hides this complexity, but understanding it helps when you hit compiler errors about Unpin. A type is Unpin if it's safe to

CompletableFuture for async programming

CompletableFuture enables non-blocking asynchronous programming in Java. I use supplyAsync() to run tasks in thread pools and thenApply() to chain transformations. thenCompose() flattens nested futures, while thenCombine() merges independent futures.

Concurrent Ruby with Ractors and Async

Ruby 3+ introduces Ractors for true parallelism without GIL limitations. Ractors are isolated actors—no shared mutable state. I use Ractors for CPU-intensive parallel processing. Messages pass between Ractors via send and receive. Async gem provides s

axum for type-safe async HTTP servers

Axum is a modern web framework built on tokio and hyper. It uses extractors (like Json<T>, Path<T>, State<S>) to parse requests into Rust types, and the compiler ensures your handlers match their routes. Middleware is just functions,

tokio::select! for racing multiple async operations

Tokio's select! macro lets you wait on multiple futures simultaneously, proceeding with the first one that completes. I use it for timeouts, graceful shutdown, and racing I/O operations. Each branch is a pattern match on the future's output. If multip

reqwest for async HTTP client with connection pooling

Reqwest is the most popular async HTTP client for Rust. It's built on tokio and hyper, with a high-level API for making requests. Connection pooling, redirects, timeouts, and TLS are handled automatically. I use the builder pattern to configure client

Event-driven architecture with Spring Events

Spring's event mechanism enables loose coupling between components. ApplicationEventPublisher publishes events. @EventListener handles events asynchronously or synchronously. Events extend ApplicationEvent or are POJOs. @TransactionalEventListener pub

Django channels for WebSockets and async

Django Channels adds WebSocket support and async capabilities. I define consumers similar to views for handling connections. The channel layer enables communication between consumers. For real-time features like chat or notifications, Channels is esse

sqlx for compile-time checked SQL queries with async

Sqlx is a pure-Rust SQL client that checks queries at compile time against your database schema. The query! macro connects to your DB during compilation and validates that columns and types match. This catches typos and schema drift before runtime. It

tokio::spawn for concurrent task execution

Tokio's spawn creates a new async task that runs concurrently on the runtime's thread pool. Unlike OS threads, tasks are lightweight (kilobytes of memory) and scheduled cooperatively. Each task must be 'static and Send, meaning it can't borrow local v