f8b21af4be
10_Wiki/Topics 대규모 정리: - 오류 캡처/미완성 stub 문서 227개 제거 - 교차폴더 중복 43클러스터 병합 (63파일 → redirect) - 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건 - 카테고리 MOC 6개 신규 생성 - Graph 섹션 미해결 related-keyword 링크 10,058건 제거 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
137 lines
4.1 KiB
Markdown
137 lines
4.1 KiB
Markdown
---
|
|
id: wiki-2026-0508-problem-solving-skills
|
|
title: Problem Solving Skills
|
|
category: 10_Wiki/Topics
|
|
status: verified
|
|
canonical_id: self
|
|
aliases: [Problem Solving, 문제 해결 능력, debugging skills]
|
|
duplicate_of: none
|
|
source_trust_level: A
|
|
confidence_score: 0.9
|
|
verification_status: applied
|
|
tags: [meta, debugging, engineering, methodology]
|
|
raw_sources: []
|
|
last_reinforced: 2026-05-10
|
|
github_commit: pending
|
|
tech_stack:
|
|
language: meta
|
|
framework: methodology
|
|
---
|
|
|
|
# Problem Solving Skills
|
|
|
|
## 매 한 줄
|
|
> **"매 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)
|
|
1. **Understand**: 매 input/output/constraint 매 명시.
|
|
2. **Plan**: 매 known similar problem과 매 mapping.
|
|
3. **Execute**: 매 plan 매 step-by-step.
|
|
4. **Review**: 매 result verify, 매 generalize.
|
|
|
|
### 매 Debugging 전용 loop
|
|
- **매 Reproduce**: 매 minimal repro case.
|
|
- **매 Bisect**: 매 git bisect / binary search.
|
|
- **매 Hypothesize**: 매 1개 변수만 매 변경.
|
|
- **매 Verify**: 매 test 매 추가.
|
|
- **매 Postmortem**: 매 root cause + prevention.
|
|
|
|
### 매 응용
|
|
1. Production incident response (5-why).
|
|
2. Algorithm design (decomposition + invariants).
|
|
3. LLM prompt debugging (delta isolation).
|
|
|
|
## 💻 패턴
|
|
|
|
### Minimal repro extraction
|
|
```python
|
|
# Bisect a failing input down to minimal case
|
|
def minimal_repro(input_list, fails):
|
|
while True:
|
|
for i in range(len(input_list)):
|
|
candidate = input_list[:i] + input_list[i+1:]
|
|
if fails(candidate):
|
|
input_list = candidate
|
|
break
|
|
else:
|
|
return input_list
|
|
```
|
|
|
|
### Git bisect automation
|
|
```bash
|
|
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
|
|
```yaml
|
|
# postmortem.yaml
|
|
incident: api 500 spike
|
|
why_1: db connections exhausted
|
|
why_2: connection leak in /search handler
|
|
why_3: exception bypassed `with` cleanup
|
|
why_4: custom context manager swallowed asyncio.CancelledError
|
|
why_5: copy-pasted snippet from Stack Overflow without review
|
|
fix: replace with asynccontextmanager + add lint rule
|
|
```
|
|
|
|
### Hypothesis-driven test
|
|
```python
|
|
# Change ONE variable per iteration
|
|
import time
|
|
def measure(config):
|
|
t = time.time(); run(config); return time.time() - t
|
|
|
|
base = {"batch": 32, "workers": 4, "cache": True}
|
|
for k in base:
|
|
cfg = {**base, k: not base[k] if isinstance(base[k], bool) else base[k]*2}
|
|
print(k, measure(cfg))
|
|
```
|
|
|
|
### Rubber-duck logger
|
|
```python
|
|
def trace_state(label, **vars):
|
|
print(f"[{label}]", " | ".join(f"{k}={v!r}" for k, v in vars.items()))
|
|
|
|
trace_state("before-loop", i=0, total=len(data), seen=set())
|
|
```
|
|
|
|
## 매 결정 기준
|
|
| 상황 | Approach |
|
|
|---|---|
|
|
| Bug 매 reproducible | Bisect + minimal repro |
|
|
| Bug 매 intermittent | Logging + statistical test |
|
|
| Algorithm 매 unknown | Polya + analogy from known |
|
|
| Production incident | 5-why + postmortem |
|
|
|
|
**기본값**: Reproduce → Bisect → Hypothesize → Verify → Document.
|
|
|
|
## 🔗 Graph
|
|
- 부모: [[Debugging]]
|
|
- 변형: [[Polya-Method]] · [[Bisect]]
|
|
- 응용: [[Postmortem]]
|
|
- Adjacent: [[Scientific-Method]]
|
|
|
|
## 🤖 LLM 활용
|
|
**언제**: 매 ill-defined task decomposition, 매 stuck-state escape, 매 LLM prompt 디버깅.
|
|
**언제 X**: 매 trivial 1-line typo (overhead).
|
|
|
|
## ❌ 안티패턴
|
|
- **매 Shotgun debugging**: 매 random 변경 후 매 동작하면 commit.
|
|
- **매 Symptom-only fix**: 매 root cause 무시.
|
|
- **매 No repro**: 매 "내 환경에선 됨".
|
|
- **매 Heisenbug 회피**: 매 logging 추가하면 매 사라지는 bug 매 무시.
|
|
|
|
## 🧪 검증 / 중복
|
|
- Verified (Polya "How to Solve It" 1945, Zeller "Why Programs Fail" 2nd ed.).
|
|
- 신뢰도 A.
|
|
|
|
## 🕓 Changelog
|
|
| 날짜 | 변경 |
|
|
|---|---|
|
|
| 2026-05-08 | Phase 1 |
|
|
| 2026-05-10 | Manual cleanup — Polya + debugging loop + repro/bisect patterns |
|