9148c358d0
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 폴더 제거.
5.6 KiB
5.6 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-high-cohesion-low-coupling | High Cohesion Low Coupling | 10_Wiki/Topics | verified | self |
|
none | A | 0.95 | applied |
|
2026-05-10 | pending |
|
High Cohesion Low Coupling
매 한 줄
"매 module 내부 의 element 의 strong relatedness (cohesion) + module 간 의 minimal dependency (coupling) 의 maximize". 매 Larry Constantine 의 1968 structured design 의 origin, 매 modern 의 SOLID, DDD bounded context, microservices 의 universal foundation — 매 changeability 의 single 의 most important predictor.
매 핵심
매 Cohesion 7 levels (Constantine, low → high)
- Coincidental (random grouping).
- Logical (similar category, e.g., "Utils").
- Temporal (executed at same time).
- Procedural (sequence of steps).
- Communicational (act on same data).
- Sequential (output of one → input of next).
- Functional (single, well-defined task) — 매 target.
매 Coupling 6 levels (low → high)
- Data (parameters of primitives) — 매 ideal.
- Stamp (parameters of composite).
- Control (flag-driven branching).
- External (shared protocol).
- Common (shared global).
- Content (one module 의 internals 의 mutate) — 매 worst.
매 응용
- Module boundary 의 design.
- Microservice 의 split criteria (DDD bounded context).
- Refactoring 의 direction-finder.
💻 패턴
Smell — Low Cohesion
// 🚨 Logical cohesion only
export class Utils {
formatDate(d: Date) { /* ... */ }
parseCSV(s: string) { /* ... */ }
hashPassword(p: string) { /* ... */ }
sendEmail(to: string) { /* ... */ }
}
Refactor — Functional Cohesion
// formatting/date.ts
export const formatISO = (d: Date) => d.toISOString().slice(0, 10);
// parsing/csv.ts
export const parseCSV = (s: string) => /* ... */;
// auth/password.ts
export const hashPassword = (p: string) => bcrypt.hash(p, 12);
// email/send.ts
export const sendEmail = (to: string, body: string) => transporter.send(/* ... */);
Smell — High Coupling (Content)
class OrderService {
constructor(private inventory: InventoryService) {}
reserve(id: string) {
// 🚨 Reaches into private state
this.inventory['stock'].set(id, 0);
}
}
Refactor — Data Coupling via Interface
interface InventoryPort {
reserve(sku: string, qty: number): Promise<ReservationId>;
}
class OrderService {
constructor(private inventory: InventoryPort) {}
async reserve(sku: string, qty: number) {
return this.inventory.reserve(sku, qty);
}
}
Dependency Inversion (Hexagonal)
// domain/order.ts (no infra import)
export interface OrderRepository {
save(o: Order): Promise<void>;
byId(id: string): Promise<Order | null>;
}
// infra/postgres-order-repo.ts
export class PostgresOrderRepository implements OrderRepository { /* ... */ }
// app/wire.ts
const repo: OrderRepository = new PostgresOrderRepository(pool);
const svc = new OrderService(repo);
Event-Driven Decoupling
// publisher
events.emit('OrderPlaced', { orderId, customerId, total });
// subscribers (independent modules)
events.on('OrderPlaced', sendConfirmationEmail);
events.on('OrderPlaced', updateAnalytics);
events.on('OrderPlaced', allocateInventory);
Coupling Metric — Fan-in / Fan-out
# madge 의 dep graph
npx madge --circular --extensions ts src/
npx madge --summary --extensions ts src/ # fan-in/fan-out per module
매 결정 기준
| 상황 | Approach |
|---|---|
| Module > 500 LOC, scattered concerns | Split by responsibility (cohesion↑) |
| Module imports 20+ siblings | Introduce interface / facade |
| Cross-module mutation | Event / message passing |
| Shared mutable global | Replace with pure function or DI |
| Microservice split | DDD bounded context boundary |
기본값: 매 functional cohesion + data coupling 의 target — 매 interface 의 통한 dependency 의 invert.
🔗 Graph
- 부모: Software-Architecture · Modularity
- 변형: Single Responsibility Principle (SRP) · Bounded Context · Hexagonal Architecture
- 응용: SOLID · Microservices · Clean-Architecture
- Adjacent: God-Object-Antipattern · Dependency-Inversion
🤖 LLM 활용
언제: module 의 cohesion/coupling 의 review, refactor 의 direction 의 suggest, dep graph 의 hot-spot 의 highlight. 언제 X: 매 architectural boundary 의 final decision (domain expert + business context 필요).
❌ 안티패턴
- God Module: low cohesion + high fan-in (모두 의 import).
- Anemic Module: data 만, behavior 의 다른 module 의 own → procedural disguised as OOP.
- Tight ORM coupling: domain entity 의 ORM annotation 의 saturation → infra 의 leak.
- Premature abstraction: 매 single use-case 의 interface 의 introduce → 매 indirection 의 cost.
- Shared library 의 god lib: 매 service 의 shared "common" 의 god — 매 deploy lockstep.
🧪 검증 / 중복
- Verified (Constantine "Structured Design" 1979, Martin "Clean Architecture", Evans "DDD").
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — cohesion/coupling principles 의 full content |