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:
Antigravity Agent
2026-07-05 00:33:48 +09:00
parent 1cfd3bbb56
commit 9148c358d0
6455 changed files with 1 additions and 86875 deletions
@@ -0,0 +1,139 @@
---
id: wiki-2026-0508-preserve-whole-object-객체-통째로-넘기기
title: Preserve Whole Object (객체 통째로 넘기기)
category: 10_Wiki/Topics
status: verified
canonical_id: self
aliases: [Preserve Whole Object, 객체 통째로 넘기기, pass whole object]
duplicate_of: none
source_trust_level: A
confidence_score: 0.9
verification_status: applied
tags: [refactoring, code-smell, parameter-list, fowler]
raw_sources: []
last_reinforced: 2026-05-10
github_commit: pending
tech_stack:
language: python-typescript
framework: refactoring
---
# Preserve Whole Object (객체 통째로 넘기기)
## 매 한 줄
> **"매 여러 field를 매 풀어 넘기지 말고 매 객체 자체를 넘겨라"**. Preserve Whole Object은 Fowler "Refactoring" (1999, 2nd ed. 2018) 의 매 catalog refactoring — 매 호출자가 매 객체에서 매 여러 값을 매 추출해 매 인자로 넘기는 매 패턴을 매 객체 통째로 매 넘기는 매 형태로 매 변환. 매 parameter list 축소 + 매 의존성 명시화.
## 매 핵심
### 매 적용 trigger
- 매 호출자가 매 한 객체에서 매 3+ 값을 매 추출해 매 인자로 넘김.
- 매 같은 추출 패턴이 매 여러 callsite에서 매 반복.
- 매 추후 다른 field가 매 필요해질 때 매 signature 변경 비용.
### 매 Trade-off
- **장점**: parameter list 축소, 매 future-proof, 매 객체 의존성 명시.
- **단점**: 매 callee의 매 객체 의존도 증가, 매 testability 저하 가능 (큰 객체 mock).
- **언제 X**: 매 callee가 매 domain 외부 (해당 객체 unknown), 매 12 field만 사용.
### 매 응용
1. Range comparison: `inRange(low, high)``inRange(range)`.
2. Validation: `validate(name, email, age)``validate(user)`.
3. Pricing: `quote(item.price, item.tax, item.discount)``quote(item)`.
## 💻 패턴
### Before / After (Python)
```python
# 매 Before — primitive obsession + parameter explosion
def is_within(low: float, high: float, value: float) -> bool:
return low <= value <= high
low, high = room.days_temp_range.low, room.days_temp_range.high
if is_within(low, high, today.low) and is_within(low, high, today.high):
alert()
# 매 After — preserve whole object
def is_within(rng: "Range", value: float) -> bool:
return rng.low <= value <= rng.high
if room.range.contains(today.low) and room.range.contains(today.high):
alert()
```
### Method extraction onto the object
```python
@dataclass(frozen=True)
class Range:
low: float
high: float
def contains(self, v: float) -> bool: return self.low <= v <= self.high
def overlaps(self, o: "Range") -> bool:
return self.low <= o.high and o.low <= self.high
```
### Validation refactor
```python
# Before
def validate_user(name: str, email: str, age: int, country: str): ...
# After
@dataclass
class UserDraft:
name: str; email: str; age: int; country: str
def validate_user(u: UserDraft): ...
```
### TypeScript variant
```typescript
// 매 Before
function quote(price: number, tax: number, discount: number) { ... }
// 매 After
interface PricedItem { price: number; tax: number; discount: number; }
function quote(item: PricedItem) { ... }
```
### IDE refactoring (PyCharm/IntelliJ)
```text
1. Extract Class → 매 Range (low, high).
2. Move Method → contains() onto Range.
3. Inline Variable → low, high at callsite.
4. Replace Parameter with Method Call → is_within(range, value).
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| 3+ field 매 같은 객체에서 추출 | Preserve Whole Object |
| 12 field만 사용 | 매 raw param OK |
| Cross-context call (객체 unknown) | 매 raw param + DTO |
| Hot loop, 매 객체 매 large | 매 individual primitive (perf) |
**기본값**: 3+ field 매 reuse 시 매 객체 통째로.
## 🔗 Graph
- 부모: [[Refactoring_Best_Practices|Refactoring]] · [[Code-Smell]]
- 변형: [[Extract-Class]]
- 응용: [[Feature-Envy]]
- Adjacent: [[Primitive Obsession (기본 타입 집착)]]
## 🤖 LLM 활용
**언제**: 매 long parameter list refactor, 매 API surface 정리.
**언제 X**: 매 cross-process boundary (DTO/serialization 고려).
## ❌ 안티패턴
- **매 God object 통째로 넘김**: 매 너무 큰 객체 매 의존성 폭발.
- **매 Mock hell**: 매 unit test 시 매 모든 field 매 mock.
- **매 Stale DTO**: 매 object 와 매 DTO 매 분리 안 해 매 layer leak.
- **매 매 통째 매 무비판적용**: 매 1 field만 사용해도 매 객체 통째로.
## 🧪 검증 / 중복
- Verified (Fowler "Refactoring" 2nd ed. 2018, ch. 11 "Preserve Whole Object").
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — Fowler refactoring + before/after Python/TS |