c24165b8bc
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게 [공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류. 문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인). - Topic_Programming → Domain_Programming (내부 구조 보존) - Topic_Graphic → Domain_Design - Topic_Business → Domain_Product - Topic_General → Domain_General - _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning), Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing) - 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서) - 빈 폴더 정리 (memory/procedures) - 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
4.7 KiB
4.7 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-preserve-whole-object-객체-통째로-넘기기 | Preserve Whole Object (객체 통째로 넘기기) | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
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), 매 1–2 field만 사용.
매 응용
- Range comparison:
inRange(low, high)→inRange(range). - Validation:
validate(name, email, age)→validate(user). - Pricing:
quote(item.price, item.tax, item.discount)→quote(item).
💻 패턴
Before / After (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
@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
# 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
// 매 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)
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 |
| 1–2 field만 사용 | 매 raw param OK |
| Cross-context call (객체 unknown) | 매 raw param + DTO |
| Hot loop, 매 객체 매 large | 매 individual primitive (perf) |
기본값: 3+ field 매 reuse 시 매 객체 통째로.
🔗 Graph
- 부모: Refactoring_Best_Practices · 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 |