docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
This commit is contained in:
@@ -0,0 +1,153 @@
|
||||
---
|
||||
id: wiki-2026-0508-하향식-탐색-top-down-approach
|
||||
title: 하향식 탐색 Top-Down Approach
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Top-Down Design, Stepwise Refinement, 하향식 설계]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [architecture, design-method, decomposition]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: language-agnostic
|
||||
framework: design-method
|
||||
---
|
||||
|
||||
# 하향식 탐색 (Top-Down Approach)
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 큰 그림 → 매 세부"**. 매 system 의 high-level abstraction 부터 시작 → 매 단계마다 decomposition. 매 1970s Niklaus Wirth 의 stepwise refinement 가 origin — 매 modern 2026 microservice / DDD 의 strategic design 까지 매 살아있는 design heuristic.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 핵심 idea
|
||||
- **매 추상 → 매 구체**: System 전체 → subsystems → modules → functions → lines.
|
||||
- **매 deferred decision**: Lower-level detail 의 결정 의 미루기 — 매 abstraction barrier.
|
||||
- **매 wishful thinking**: 매 "이 helper 가 있다 가정" → 매 나중에 implement.
|
||||
|
||||
### 매 vs Bottom-Up
|
||||
- Top-Down: 매 unknown / new system 의 design 적합. 매 risk: leaf-level 에서 매 mismatch 발견.
|
||||
- Bottom-Up: 매 reusable primitive 부터. 매 known domain (e.g. data pipeline) 적합.
|
||||
- 매 실전: 매 hybrid (meet-in-middle) 의 default.
|
||||
|
||||
### 매 응용
|
||||
1. DDD strategic design — bounded context → context map → aggregate.
|
||||
2. Microservice decomposition — capability mapping → service boundary.
|
||||
3. Functional decomposition — main() → step functions → primitives.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Stepwise refinement (pseudocode → real)
|
||||
```python
|
||||
# Level 0: intent
|
||||
def process_orders():
|
||||
"""Process today's orders end-to-end."""
|
||||
|
||||
# Level 1: high-level steps
|
||||
def process_orders():
|
||||
orders = fetch_pending_orders()
|
||||
validated = [o for o in orders if validate(o)]
|
||||
results = [charge_and_ship(o) for o in validated]
|
||||
notify_customers(results)
|
||||
|
||||
# Level 2: implement leaves (deferred until now)
|
||||
def fetch_pending_orders() -> list[Order]:
|
||||
return db.query(Order).filter(Order.status == "pending").all()
|
||||
```
|
||||
|
||||
### Wishful thinking — assume helpers exist
|
||||
```python
|
||||
def render_dashboard(user_id: str) -> HTML:
|
||||
user = fetch_user(user_id) # assume
|
||||
metrics = compute_metrics(user) # assume
|
||||
chart = build_chart(metrics) # assume
|
||||
return layout(header(user), chart) # assume
|
||||
# 매 implement leaves 의 last.
|
||||
```
|
||||
|
||||
### DDD top-down decomposition
|
||||
```
|
||||
Bounded Context: Order Management
|
||||
├─ Aggregate: Order
|
||||
│ ├─ Entity: OrderLine
|
||||
│ └─ Value Object: Money, Address
|
||||
├─ Aggregate: Cart
|
||||
└─ Domain Service: Pricing
|
||||
```
|
||||
|
||||
### Microservice capability decomposition
|
||||
```yaml
|
||||
# top-down: business capability → service
|
||||
Capability: Checkout
|
||||
Sub-capability: Cart Management → cart-service
|
||||
Sub-capability: Payment → payment-service
|
||||
Sub-capability: Order Persistence → order-service
|
||||
Sub-capability: Notification → notification-service
|
||||
```
|
||||
|
||||
### Test-first top-down (London-school TDD)
|
||||
```python
|
||||
def test_charge_order_calls_gateway(mocker):
|
||||
gateway = mocker.Mock()
|
||||
repo = mocker.Mock()
|
||||
svc = OrderService(gateway, repo) # 매 collaborator 추측
|
||||
svc.charge(Order(id=1, total=100))
|
||||
gateway.charge.assert_called_once_with(100)
|
||||
# 매 mock 의 design 의 driver — 매 collaborator interface 의 top-down emerge.
|
||||
```
|
||||
|
||||
### Recursive descent parser (top-down classic)
|
||||
```python
|
||||
def parse_expr(tokens):
|
||||
left = parse_term(tokens)
|
||||
while tokens.peek() in ("+", "-"):
|
||||
op = tokens.next()
|
||||
right = parse_term(tokens)
|
||||
left = BinOp(op, left, right)
|
||||
return left
|
||||
|
||||
def parse_term(tokens):
|
||||
left = parse_factor(tokens)
|
||||
# ...
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Greenfield, unknown domain | **Top-Down** (explore via decomposition) |
|
||||
| Known primitives, integration heavy | Bottom-Up |
|
||||
| Library 의 design | Bottom-Up (primitive first) |
|
||||
| Application / product 의 design | Top-Down → Hybrid |
|
||||
| Refactor existing code | Inside-Out (seam first) |
|
||||
|
||||
**기본값**: Top-Down 으로 strategy → bottom-up primitive 의 meet-in-middle.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[아키텍처 패턴 지식]] · [[객체 지향 소프트웨어 아키텍처 설계]]
|
||||
- 변형: [[Bottom Up Approach]]
|
||||
- 응용: [[DDD]] · [[Hexagonal_Architecture]] · [[Refactoring Techniques (리팩토링 기법)]]
|
||||
- Adjacent: [[추상화(Abstraction)]] · [[High-Cohesion-Low-Coupling]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 새로운 system 의 design 의 시작, 매 unknown domain 의 explore, 매 architectural conversation 의 frame.
|
||||
**언제 X**: 매 well-known primitive 의 mechanical assembly, 매 retrofit / legacy refactor (seam-first 가 더 안전).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Pseudocode 가 implementation 화**: 매 leaf 의 implement 안 함. 매 wishful 의 영원히 wish.
|
||||
- **Premature decomposition**: 매 너무 일찍 fix layer boundary → 매 나중에 leaky.
|
||||
- **No bottom check**: 매 leaf primitive 가 매 expressible 인지 verify 안 함 → 매 mismatch.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Wirth 1971 "Program Development by Stepwise Refinement"; Evans DDD 2003).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — top-down 의 stepwise refinement / wishful thinking / DDD-microservice 의 application |
|
||||
Reference in New Issue
Block a user