Search
Lessons (40)
- Clean Error Handling
Fail loudly, fail early, and never swallow errors. Learn how to handle errors so bugs are easy to …
- TypeScript Essentials
… return "Loading…"; case "error": return Error: ${state.error} ; // error exists only here case "success": return ${state.data.length …
- REST API Design
… Consistent error format Pick one error shape and use it everywhere. [RFC 9457 "Problem Details"](https://www.rfc …
- Resilience Patterns
… timeouts, 502, 503, 504, 429 (respect Retry-After ). - ❌ Don't retry client errors: 400, 401, 403, 404, 422 …
- Observability: Logs, Metrics & Traces
… every field is searchable logger.error( { event: "payment failed", userId: 42, orderId: "ord 9", amountCents: 4999, provider: "stripe …
- Design a Reliable Notification System
… Retry transient errors with backoff; move poison work to a DLQ for investigation. Watch oldest-job age, provider …
- State Management (Redux, Zustand, TanStack Query)
… 60 000, // treat data as fresh for 1 minute }); if (isPending) return <Spinner / ; if (error) return <ErrorMessage error …
- Data Structures for Scale
Use geospatial indexes and probabilistic structures to make huge queries practical while understanding their error bounds. ![Scale-oriented …
- I — Interface Segregation Principle
… Image { throw new Error("Not supported"); } // ❌ fax(): void { throw new Error("Not supported"); } // ❌ staple(): void { throw new Error …
- Consumers & Consumer Groups
… offsets are committed, and how to handle lag, errors and retries. The big idea A pile of mail …
- React Fundamentals
… and tidy. Conditional rendering jsx {isLoading && <Spinner / } {error ? <ErrorMessage error={error} / : <UserList users={users} / } {items.length === 0 && <EmptyState …
- DRY: Don't Repeat Yourself
… throw new Error("Invalid email"); // profile.js if (!/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(email)) throw new Error("Invalid email …
- Microkernel (Plugin) Architecture
… this { if (this.plugins.some((p) = p.name === plugin.name)) throw new Error( Plugin ${plugin.name} already registered …
- Deploying & Operating Microservices
… latency, traffic, errors, saturation. - Correlate everything in one place (Grafana, Datadog, Honeycomb). (See Backend → Observability for the details …
- MVC, MVP & MVVM
… vm.setPassword(e.target.value)} / {vm.error && <p role="alert" {vm.error}</p } <button disabled={!vm.canSubmit} Log …
- L — Liskov Substitution Principle
… flap / } } class Penguin extends Bird { fly() { throw new Error("Penguins can't fly"); } // ❌ breaks every caller of Bird …
- API Contracts, Gateways and Security
… l6/api-security.svg) Define resource/command contracts, error shapes, pagination, idempotency and compatibility before implementation. JSON is …
- Backend Languages: Node.js, Go, Python & Rust
… Docker and Kubernetes are written in Go) Verbose error handling, a smaller ecosystem than JS/Python Python async …
- Networking, DNS and Traffic Routing
… Monitor DNS TTL/propagation, edge health, connection errors, regional latency and uneven load. A DNS answer is not …
- Creational Patterns: How to Make Objects
… const Notifier = notifiers[type]; if (!Notifier) throw new Error( Unknown notifier: ${type} ); return new Notifier(); } createNotifier(user.preferredChannel …
- Finding Service Boundaries with DDD
… draft") throw new Error("Cannot change a submitted order"); if (quantity <= 0) throw new Error("Quantity must be …
- Timeouts, Retries & Backpressure
… jobs to a visible DLQ. Watch: queue age, saturation, rejected work, dependency latency, retries, and error-budget burn.
- Debug Latency Like an Investigator
… Record window, route/tenant/region, percentiles, error rate. 2. Compare healthy and slow traces; locate the span that …
- React Hooks in Practice
… throw new Error( Unknown action ${action.type} ); } } const [cart, dispatch] = useReducer(cartReducer, { items: [] }); dispatch({ type: "add", item }); useEffect …
- Frontend Testing Strategy
… Tests Tools Speed Confidence --- --- --- --- --- Static Types and lint errors TypeScript, ESLint ⚡⚡⚡ Catches typos and type bugs Unit One …
- Premiere-Night Video Streaming
… progress backward. Watch: startup time, rebuffer ratio, CDN hit rate, origin egress, manifest errors, and control-plane p99.
- KISS: Keep It Simple, Stupid
… registry.get(type))(); } } class AbstractNotificationStrategy { send() { throw new Error("abstract"); } } class EmailNotificationStrategy extends AbstractNotificationStrategy { / … / } const strategy = new NotificationStrategyFactory …
- Data in Microservices: Sagas & the Outbox Pattern
… reverse order await orders.markCancelled(order.id, error.message); throw error; } } ✅ The whole flow is visible and testable …
- Structural Patterns: How to Connect Objects
… throw new Error("role is read-only"); if (prop === "balance" && value < 0) throw new Error("balance can't …
- Small Functions That Do One Thing
… new Error("Bad email"); if (!req.body.password req.body.password.length < 8) throw new Error("Weak password …
- How a Web Request Works
… Too Many Requests 5xx 💥 Server failed 500 Internal Error, 502 Bad Gateway, 503 Unavailable, 504 Gateway Timeout 5 …
- Code Smells & Refactoring
… cents, currency) { if (!Number.isInteger(cents)) throw new Error("Money must be whole cents"); this.cents = cents; this …
- Pods
… a container exited with an error Running -- Running: container crashed and was restarted Succeeded -- [ ] Failed -- [ ] Status you'll …
- Delivery Guarantees: At-Most, At-Least & Exactly Once
… catch (error) { await tx.abort(); // nothing written, offset not committed → the message will be retried throw error; } }, }); Consumers …
- Behavioral Patterns I: Observer, Strategy, Command, State
… cancelled"; } else if (order.status === "shipped") throw new Error("Too late to cancel"); // …repeat in pay(), ship(), deliver …
- Event-Driven Architecture
… compensate I ✅ The flow and error handling are in one place. ❌ The mediator is extra coupling and a …
- O — Open/Closed Principle
… Then Klarna → edit again… throw new Error("Unknown payment method"); } After: plug-in strategies js // ✅ Each payment method …
- What Is Clean Code?
… one thing Rules of thumb KISS DRY YAGNI Errors Fail loudly No silent catch Structure Code smells Refactoring …
- YAGNI: You Aren't Gonna Need It
… Clear names and structure Generic BaseAbstractManager<T classes Error handling and security Caching layer before measuring slowness Code …
- Linked Lists
… save current.next before changing it. - Null pointer errors: check node && node.next before node.next.next . - Forgetting …