"매 90% of programming is reading code, not writing it.". 매 Brooks (1983), Pennington (1987), Soloway (1986) 의 cognitive software engineering 연구에서 출발한 매 분야 — 매 code → mental model 변환의 strategies. 매 2026 LLM 시대에는 매 Cursor/Claude Code 의 contextual indexing 이 매 human comprehension 을 augment.
매 핵심
매 3대 strategy
Top-down (Brooks): 매 hypothesis 형성 → code 로 verify. 매 domain expert 가 사용.
Bottom-up (Pennington): 매 statement → control-flow → data-flow → program model. 매 novice 가 사용.
Opportunistic (mixed): 매 expert programmer 의 실제 행동 — top-down 시작, beacon 발견 시 bottom-up 으로 dive.
매 cognitive constructs
Beacons: 매 recognizable patterns (e.g., for(i=0; i<n; i++) → 매 loop, swap(a,b) → 매 sort).
Plans: 매 stereotypical solutions (e.g., search plan, accumulator plan).
Chunks: 매 functionally cohesive code groups stored as 1 unit in working memory.
매 응용
Code review: 매 reviewer 는 top-down — PR 의 의도 파악 후 specific changes 검증.
Onboarding: 매 new dev 는 bottom-up — small fixes 로 시작, 점진적 chunking.
AI-assisted reading: 매 LLM 에게 code summarization → human 이 hypothesis 생성.
💻 패턴
Pattern 1: Top-down hypothesis-driven reading
# 매 step 1: read README / docstring → 매 form hypothesis# 매 step 2: locate entry point (main, app.py)# 매 step 3: trace only the path that confirms/refutes hypothesisdeftrace_hypothesis(repo,hypothesis):entry=find_entry_point(repo)call_graph=build_call_graph(entry)relevant=filter_by_keyword(call_graph,hypothesis.keywords)returnrelevant
Pattern 2: Beacon recognition (LLM-augmented)
importanthropicclient=anthropic.Anthropic()defextract_beacons(code:str)->list[str]:resp=client.messages.create(model="claude-opus-4-7",max_tokens=1024,system="Identify recognizable code patterns (beacons) and name their plan.",messages=[{"role":"user","content":f"```\n{code}\n```"}],)returnparse_beacons(resp.content[0].text)
Pattern 3: Chunking via cohesion analysis
defchunk_function(ast_node):"""매 group statements by 매 shared variables (cohesion)."""chunks,current=[],[]last_vars=set()forstmtinast_node.body:vars=extract_vars(stmt)iflast_varsandnot(vars&last_vars):chunks.append(current)current=[]current.append(stmt)last_vars=varsifcurrent:chunks.append(current)returnchunks
Pattern 4: Cross-reference walking (bottom-up)
# 매 ripgrep + ctags-driven exploration
rg -l "AuthService" --type ts | head -5
rg "class AuthService" --type ts -A 30
rg "new AuthService\(" --type ts # 매 callers
Pattern 5: LLM-driven code summarization
# 매 Claude Code-style structured summaryPROMPT="""Summarize this file with:
1. 매 PURPOSE (1 sentence)
2. 매 KEY DATA STRUCTURES
3. 매 PUBLIC API
4. 매 NON-OBVIOUS CONTRACTS / INVARIANTS
5. 매 DEPENDENCIES (incoming + outgoing)
"""defsummarize(file_path):code=open(file_path).read()returnclaude_call(PROMPT+f"\n```\n{code}\n```")
Pattern 6: Mental model checkpointing
<!-- 매 personal-notes.md per repo while reading -->
## Module: auth/
- Purpose: JWT issuance & verification
- Entry: `auth/router.ts:loginHandler`- Key invariant: tokens always include `iss=our-domain`- Open Q: where is refresh-token rotation?
Pattern 7: Diagram-first — produce dependency graph before reading
madge --image deps.svg src/
# 매 visual chunking — see clusters before diving
매 결정 기준
상황
Strategy
매 domain familiar, code new
Top-down
매 domain new, code small
Bottom-up
매 large unknown codebase
Opportunistic + diagram first
매 bug hunt
Bottom-up from stack trace
매 architecture review
Top-down from entry points
매 LLM augmentation
Summarize → form hypothesis → verify
기본값: 매 opportunistic — 매 README + entry point 부터 시작, beacon 발견 시 dive.
언제: 매 onboarding new repo, 매 reviewing large PR, 매 understanding legacy code, 매 building mental model.
언제 X: 매 1-line hot-fix 에 over-engineering 하지 마라.
❌ 안티패턴
Read everything linearly: 매 working memory 초과 — chunking 없이 무너짐.
Skip the README: 매 hypothesis 없이 bottom-up 만 → 매 lost in details.
No checkpointing: 매 1시간 후 모두 잊음 — write down mental model.
Trust LLM summary blindly: 매 hallucination 위험 — 매 verify on key claims.