"매 problem 정의가 매 solution의 매 절반". Problem solving은 매 ill-defined situation을 매 well-defined sub-problems으로 매 decompose하고 매 hypothesis-test loop으로 매 narrow down하는 매 transferable skill set. Polya (1945) 4-step부터 매 modern debugging 까지 매 동일한 backbone.
매 핵심
매 Polya 4-step (1945)
Understand: 매 input/output/constraint 매 명시.
Plan: 매 known similar problem과 매 mapping.
Execute: 매 plan 매 step-by-step.
Review: 매 result verify, 매 generalize.
매 Debugging 전용 loop
매 Reproduce: 매 minimal repro case.
매 Bisect: 매 git bisect / binary search.
매 Hypothesize: 매 1개 변수만 매 변경.
매 Verify: 매 test 매 추가.
매 Postmortem: 매 root cause + prevention.
매 응용
Production incident response (5-why).
Algorithm design (decomposition + invariants).
LLM prompt debugging (delta isolation).
💻 패턴
Minimal repro extraction
# Bisect a failing input down to minimal casedefminimal_repro(input_list,fails):whileTrue:foriinrange(len(input_list)):candidate=input_list[:i]+input_list[i+1:]iffails(candidate):input_list=candidatebreakelse:returninput_list
Git bisect automation
git bisect start HEAD v1.0.0
git bisect run pytest tests/test_regression.py::test_bug
# 매 Bisect 자동 종료 → first-bad-commit 매 출력
5-why root cause
# postmortem.yamlincident:api 500 spikewhy_1:db connections exhaustedwhy_2:connection leak in /search handlerwhy_3:exception bypassed `with` cleanupwhy_4:custom context manager swallowed asyncio.CancelledErrorwhy_5:copy-pasted snippet from Stack Overflow without reviewfix:replace with asynccontextmanager + add lint rule
Hypothesis-driven test
# Change ONE variable per iterationimporttimedefmeasure(config):t=time.time();run(config);returntime.time()-tbase={"batch":32,"workers":4,"cache":True}forkinbase:cfg={**base,k:notbase[k]ifisinstance(base[k],bool)elsebase[k]*2}print(k,measure(cfg))