Debugging
104 bites tagged Debugging — interview questions with model answers, and 60-second explainers.
Why-Did-You-Render: Find Unnecessary React Re-renders
The `why-did-you-render` library is a detective for your React app, finding components that re-render unnecessarily. Use it in development to debug performance by spotting when new object or function references break memoization.
Flipper: A Desktop Debugger for React Native
Flipper is a desktop debugging platform for React Native, acting like Chrome DevTools for your mobile app. It connects to your local Metro server, letting you inspect component trees, view logs, and trigger reloads. The main footgun: the project is archived.
React Native's Performance Monitor Overlay
Think of it as a quick, in-app speedometer for your app's performance. Toggle it from the Dev Menu for a live overview on your screen. The footgun: it's only a guide, not a precise tool for deep performance analysis.
Debugging Python's Asyncio
Debugging asyncio is about finding what's blocking the single-threaded event loop. Use its debug mode to detect slow callbacks and `run_in_executor` to offload CPU-bound work. The biggest mistake is calling blocking code directly, which stalls the entire app.
Heap Snapshots: Finding Node.js Memory Leaks
A heap snapshot is a photograph of your app's memory. Use it to diagnose leaks by comparing snapshots over time to see which objects grow. The big footgun: taking one freezes your app and can double memory usage, risking a crash in production.
TensorBoard: The Dashboard for Your ML Model
TensorBoard is the dashboard for your ML model, showing what's happening inside during training. It tracks key metrics like loss and accuracy, visualizes the model's structure, and helps you debug performance. The main footgun is not logging the right data.
ML Metadata: The Logging Layer for ML Pipelines
ML Metadata is the logging layer for your ML pipeline, tracking every dataset, hyperparameter, and model version. It's crucial for debugging failed runs by tracing a model back to its exact data.
Address Sanitizer: Find Memory Bugs at Runtime
Address Sanitizer (ASan) is a runtime debugging tool that finds memory corruption bugs. Enable it in Xcode to catch buffer overflows and use-after-free errors as they happen, preventing crashes that are hard to trace back to their source.
Main Thread Checker: Keep Your UI Responsive
The Main Thread Checker is an Xcode tool that catches UI updates on background threads, which cause crashes or glitches. It runs during debugging, flagging AppKit, UIKit, or SwiftUI calls made off the main thread.
Hunt Retain Cycles with the Memory Graph Debugger
Xcode's Memory Graph Debugger is a visual map of your app's live objects and their relationships. Use it to hunt down memory leaks, especially retain cycles where objects won't deallocate.
Xcode View Debugger: Uncover Hidden UI Bugs
The View Debugger is like an X-ray for your UI, showing every view and constraint in a 3D stack. Use it to find clipped labels, missing views, or un-tappable buttons. The common footgun is forgetting that invisible views can still block user input.
LLDB: Stop Time with Breakpoints
A breakpoint is a red light for your code, pausing execution at a specific line so you can inspect your program's state. In Xcode, use it to freeze your app when a bug occurs, examine variables, and step through code.
Five Whys: Find the Root Cause, Not Just the Symptom
Five Whys is a tool for digging past surface-level problems. By repeatedly asking "Why?", you trace a chain of causality back to the true root cause. It's used in post-mortems to find systemic issues, not just patch symptoms. The footgun is stopping too soon.
Go Execution Tracer: Pinpointing Concurrency Bottlenecks
Go's Execution Tracer creates a visual timeline of your program, capturing goroutine state changes, syscalls, and GC events. It's essential for diagnosing subtle concurrency issues like lock contention. The main footgun is misusing annotations for work.
Go's pprof: Finding Your Code's Hotspots
pprof is a heat map for your code, revealing which functions consume the most CPU. It samples your program's call stacks to find performance hotspots. Use it to diagnose slow API endpoints or high-CPU background jobs. The footgun: profiling under no load.
Go's Race Detector: Find Concurrency Bugs at Runtime
The Go race detector finds data races by watching memory access at runtime. Use `go test -race` in CI or on a canary instance, but remember: it only catches races that actually execute. If your tests don't trigger the race, it won't be found.
Kubernetes Events: The Cluster's Short-Term Memory
Think of Kubernetes Events as a cluster's temporary log, recording state changes like a Pod starting or a container failing. Use them with `kubectl describe` to debug issues in real-time.
The Three Pillars of Observability
Observability isn't one tool; it's a three-legged stool of metrics, logs, and traces. Metrics give the 'what' (CPU is high), logs the 'why' (an error loop), and traces the 'where' (which service is slow). The footgun is treating them as separate silos.
5 Whys: Find the Root Cause, Not the Symptom
The 5 Whys technique finds a problem's root cause by repeatedly asking "Why?" to trace a cause-and-effect chain. Use it in post-mortems to understand system failures. The footgun is blaming people instead of asking why the process allowed the error.
Source Maps: Debug Your Compiled CSS
Source maps are a decoder ring for your browser's dev tools, translating minified CSS back to the original SCSS or LESS files you wrote. This lets you debug styles in your source code, not the unreadable compressed output.
Explainable AI (XAI): Why Did the Model Do That?
Explainable AI (XAI) translates a model's 'black box' decision into a human-readable reason. Use it to debug predictions, build user trust, or meet regulatory needs. The footgun: explanations are approximations of the model's logic, not absolute truth.
Analyzing Flaky Tests
A flaky test passes and fails randomly without code changes, eroding trust in your CI pipeline. It often points to race conditions or external dependencies. The biggest footgun is ignoring them, as this teaches developers to dismiss real failures.
Distributed Tracing: Following a Request Across Microservices
Distributed tracing is like a passport for a request, stamped at every service it visits. It's essential for debugging microservices where one click can trigger many calls. The footgun is trying to debug without it, piecing together isolated logs.
Structured Logging: Logs as Data, Not Strings
Treat logs as structured data (like JSON), not just plain text. This makes them machine-readable and queryable, letting you filter, search, and create dashboards on specific fields (e.g., `user_id`, `trace_id`).
Get Debugging bites daily.
Five a day, five minutes, offline. With quizzes so it sticks.
Open testing — you’ll join as an early tester.