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,171 @@
|
||||
---
|
||||
id: wiki-2026-0508-seam-접점
|
||||
title: Seam (접점)
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Seam, Seams, 이음새, 접점, Feathers seam]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [legacy-code, refactoring, testing, feathers]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: typescript
|
||||
framework: none
|
||||
---
|
||||
|
||||
# Seam (접점)
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 코드를 매 수정하지 않고 매 동작을 바꿀 수 있는 지점"**. Michael Feathers (*Working Effectively with Legacy Code*, 2004)의 핵심 개념. Seam은 매 legacy code에 매 test를 매 끼워넣는 매 hinge — 매 dependency를 매 엮어내는 매 join point.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 정의
|
||||
- 매 place where you can alter behavior without editing in place.
|
||||
- 매 enabling point: 매 그 seam을 매 어떻게 활성화하는지 결정.
|
||||
|
||||
### 매 3 종류 (Feathers)
|
||||
1. **Preprocessing Seam** — compile/macro/언어 전처리 (C/C++ `#define`).
|
||||
2. **Link Seam** — link-time substitution (매 alt library, jest module mock).
|
||||
3. **Object Seam** — polymorphism (매 interface/subclass).
|
||||
|
||||
### 매 응용
|
||||
1. 매 legacy에 매 test 추가 — 매 substitute dependency.
|
||||
2. 매 hexagonal port — 매 object seam.
|
||||
3. 매 feature flag — 매 conditional seam.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### 매 Object Seam — interface 추출
|
||||
```typescript
|
||||
// X — 매 직접 의존
|
||||
class OrderService {
|
||||
place(o: Order) {
|
||||
new SmtpMailer().send(o.user, "ordered"); // 매 hard-wired
|
||||
}
|
||||
}
|
||||
|
||||
// O — 매 object seam
|
||||
interface Mailer { send(to: string, msg: string): void; }
|
||||
class OrderService {
|
||||
constructor(private mailer: Mailer) {}
|
||||
place(o: Order) { this.mailer.send(o.user, "ordered"); }
|
||||
}
|
||||
// 매 test에서 fake Mailer 주입.
|
||||
```
|
||||
|
||||
### 매 Link Seam — Jest module mock
|
||||
```typescript
|
||||
// orderService.ts
|
||||
import { sendEmail } from "./mailer";
|
||||
export function place(o: Order) { sendEmail(o.user, "ordered"); }
|
||||
|
||||
// orderService.test.ts
|
||||
import { place } from "./orderService";
|
||||
jest.mock("./mailer", () => ({ sendEmail: jest.fn() }));
|
||||
import { sendEmail } from "./mailer";
|
||||
|
||||
test("places", () => {
|
||||
place({ user: "a@b.com" } as any);
|
||||
expect(sendEmail).toHaveBeenCalledWith("a@b.com", "ordered");
|
||||
});
|
||||
```
|
||||
|
||||
### 매 Preprocessing Seam — TS compiler hook
|
||||
```typescript
|
||||
// 매 build-time substitution (매 e.g., babel plugin / tsx loader)
|
||||
// __ENV__ macro 가 매 build 시 replace
|
||||
declare const __TEST__: boolean;
|
||||
export function log(msg: string) {
|
||||
if (__TEST__) return;
|
||||
console.log(msg);
|
||||
}
|
||||
```
|
||||
|
||||
### 매 React Context seam
|
||||
```tsx
|
||||
const ApiContext = createContext<Api>(realApi);
|
||||
|
||||
// 매 production
|
||||
<ApiContext.Provider value={realApi}><App /></ApiContext.Provider>
|
||||
|
||||
// 매 test (Storybook/jsdom)
|
||||
<ApiContext.Provider value={fakeApi}><App /></ApiContext.Provider>
|
||||
```
|
||||
|
||||
### 매 NodeJS DI container seam (NestJS)
|
||||
```typescript
|
||||
// 매 production
|
||||
@Module({ providers: [{ provide: "Mailer", useClass: SmtpMailer }] })
|
||||
class AppModule {}
|
||||
|
||||
// 매 test
|
||||
const moduleRef = await Test.createTestingModule({
|
||||
providers: [OrderService, { provide: "Mailer", useValue: { send: jest.fn() } }],
|
||||
}).compile();
|
||||
```
|
||||
|
||||
### 매 Wrap method (Feathers technique)
|
||||
```typescript
|
||||
// X — private method 가 매 hard-coded
|
||||
class OrderService {
|
||||
place(o: Order) { this.notify(o); /* ... */ }
|
||||
private notify(o: Order) { new SmtpMailer().send(o.user, "ordered"); }
|
||||
}
|
||||
|
||||
// O — 매 protected → subclass에서 override
|
||||
class OrderService {
|
||||
place(o: Order) { this.notify(o); /* ... */ }
|
||||
protected notify(o: Order) { new SmtpMailer().send(o.user, "ordered"); }
|
||||
}
|
||||
class TestOrderService extends OrderService {
|
||||
protected notify() { /* swallow */ }
|
||||
}
|
||||
```
|
||||
|
||||
### 매 Feature flag seam
|
||||
```typescript
|
||||
const flags = await flagClient.evaluate("new-checkout", { user });
|
||||
const checkout = flags ? new NewCheckout() : new LegacyCheckout();
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Seam |
|
||||
|---|---|
|
||||
| 매 OOP + DI 가능 | Object Seam (interface). |
|
||||
| 매 legacy without DI | Link Seam (module mock). |
|
||||
| 매 C/C++ 매 macro | Preprocessing Seam. |
|
||||
| 매 React component | Context seam. |
|
||||
| 매 cross-cutting toggle | Feature flag seam. |
|
||||
|
||||
**기본값**: 매 Object Seam — 매 testability + 매 long-term cleanest.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Refactoring_Best_Practices|Refactoring]]
|
||||
- 변형: [[Object Seam (객체 접점)]] · [[Link Seam (링크 접점)]] · [[Preprocessing Seam (전처리 접점)]]
|
||||
- 응용: [[Dependency Injection]] · [[Test Doubles]] · [[Hexagonal Architecture]]
|
||||
- Adjacent: [[Scratch Refactoring (스크래치 리팩토링)]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 legacy에 매 test 끼워넣기, 매 dependency 분리, 매 refactor 진입점 식별.
|
||||
**언제 X**: 매 greenfield (매 처음부터 DI로 설계).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **매 seam 강제 too many**: 매 abstraction noise.
|
||||
- **매 enabling point 미정**: 매 seam 만들고 매 활용 X.
|
||||
- **매 monkey-patching seam (Ruby/Python)**: 매 long-term 유지보수 X.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Feathers, *Working Effectively with Legacy Code*, 2004, Ch. 4).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — Feathers 3-seam canonical + modern patterns |
|
||||
Reference in New Issue
Block a user