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,228 @@
|
||||
---
|
||||
id: wiki-2026-0508-유지보수성-maintainability
|
||||
title: 유지보수성(Maintainability)
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [Maintainability, Code Maintainability, Software Sustainability]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [software-quality, maintainability, refactoring, technical-debt, code-quality]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: TypeScript
|
||||
framework: General
|
||||
---
|
||||
|
||||
# 유지보수성(Maintainability)
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 code 의 written once 의 의 — 의 read 100x, modified 10x 의 의."**. 매 maintainability 의 의 future-self / future-team 의 의 cost 의 의 — 의 readability + modularity + testability + documentation 의 의 composite quality. 매 2026 의 의 LLM-assisted maintenance (Claude Code, Cursor) 의 의 의 well-structured code 의 의 의 의 — 의 LLM 의 의 fast & accurate refactor.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 maintainability 의 dimension
|
||||
- **Readability**: 의 명확한 이름 의 의 SRP, low cyclomatic complexity (< 10).
|
||||
- **Modularity**: high cohesion, low coupling — module boundary 의 의.
|
||||
- **Testability**: pure function 의 의, dependency injection, deterministic.
|
||||
- **Documentation**: ADR (architecture decision record), inline 의 "why" comment.
|
||||
- **Observability**: structured logging, tracing, metric — 의 production 의 의 의 의.
|
||||
|
||||
### 매 metric (proxy)
|
||||
- **Cyclomatic complexity**: < 10 per function (radon, eslint complexity rule).
|
||||
- **Lines per function**: < 50 (의 의 split).
|
||||
- **Test coverage**: > 70% line, > 60% branch.
|
||||
- **PR review time**: < 24h (proxy for code clarity).
|
||||
- **Bus factor**: ≥ 2 reviewer per module.
|
||||
|
||||
### 매 응용
|
||||
1. Code review checklist.
|
||||
2. Refactoring prioritization (의 churn × complexity).
|
||||
3. Technical debt tracking (Jira label, CODEOWNERS).
|
||||
4. Onboarding speed (의 maintainability 의 의 의 ramp-up time).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### SRP (Single Responsibility) refactor
|
||||
```ts
|
||||
// 매 BAD: 의 function 의 의 do everything
|
||||
async function processOrder(orderId: string) {
|
||||
const order = await db.orders.findOne({ id: orderId });
|
||||
if (!order) throw new Error('not found');
|
||||
const tax = order.items.reduce((s, i) => s + i.price * 0.1, 0);
|
||||
const total = order.items.reduce((s, i) => s + i.price, 0) + tax;
|
||||
await stripe.charge(order.userId, total);
|
||||
await sendgrid.send({ to: order.email, subject: 'Receipt', body: `...${total}` });
|
||||
return total;
|
||||
}
|
||||
|
||||
// 매 GOOD: composed of single-responsibility units
|
||||
async function processOrder(orderId: string): Promise<number> {
|
||||
const order = await fetchOrder(orderId);
|
||||
const total = computeTotal(order);
|
||||
await chargePayment(order.userId, total);
|
||||
await sendReceipt(order.email, total);
|
||||
return total;
|
||||
}
|
||||
```
|
||||
|
||||
### Dependency injection (testability)
|
||||
```ts
|
||||
// 매 BAD: hard dependency
|
||||
class UserService {
|
||||
async create(email: string) {
|
||||
const user = await prisma.user.create({ data: { email } });
|
||||
await sendgrid.send({ to: email }); // 의 untestable
|
||||
}
|
||||
}
|
||||
|
||||
// 매 GOOD: inject
|
||||
interface Mailer { send(msg: { to: string }): Promise<void>; }
|
||||
interface UserRepo { create(data: { email: string }): Promise<User>; }
|
||||
|
||||
class UserService {
|
||||
constructor(private repo: UserRepo, private mailer: Mailer) {}
|
||||
async create(email: string) {
|
||||
const user = await this.repo.create({ email });
|
||||
await this.mailer.send({ to: email });
|
||||
return user;
|
||||
}
|
||||
}
|
||||
|
||||
// 매 test 의 의
|
||||
const fakeMailer = { send: vi.fn() };
|
||||
const fakeRepo = { create: async (d) => ({ id: '1', ...d }) };
|
||||
new UserService(fakeRepo, fakeMailer).create('a@b.com');
|
||||
```
|
||||
|
||||
### ADR (Architecture Decision Record)
|
||||
```markdown
|
||||
# ADR-0042: 매 PostgreSQL 의 의 (vs MongoDB)
|
||||
|
||||
## Status
|
||||
Accepted — 2026-04-15
|
||||
|
||||
## Context
|
||||
주문 의 nested item, 다대다 user-org 관계 의 transaction.
|
||||
|
||||
## Decision
|
||||
PostgreSQL 16 + Prisma 의 의.
|
||||
|
||||
## Consequences
|
||||
- (+) Strong consistency, mature ecosystem
|
||||
- (+) JSONB 의 의 flexibility 의 의
|
||||
- (-) Sharding 의 의 application-level
|
||||
- (-) Horizontal scale 의 의 read replica 의 의
|
||||
```
|
||||
|
||||
### Module boundary (hexagonal-ish)
|
||||
```
|
||||
src/
|
||||
├── domain/ # 매 pure business logic, 의 framework dep
|
||||
│ ├── user.ts
|
||||
│ └── order.ts
|
||||
├── application/ # 매 use case (orchestration)
|
||||
│ └── checkout.ts
|
||||
├── infrastructure/ # 매 DB / HTTP / queue adapter
|
||||
│ ├── prisma-user-repo.ts
|
||||
│ └── stripe-payment.ts
|
||||
└── interface/ # 매 HTTP / gRPC controller
|
||||
└── http-routes.ts
|
||||
```
|
||||
|
||||
### Cyclomatic complexity check (eslint)
|
||||
```json
|
||||
{
|
||||
"rules": {
|
||||
"complexity": ["error", { "max": 10 }],
|
||||
"max-lines-per-function": ["warn", { "max": 50, "skipComments": true }],
|
||||
"max-depth": ["warn", 3]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Churn × complexity heatmap
|
||||
```bash
|
||||
# 매 git 의 의 churn 의 의 의 의 file 의 의
|
||||
git log --since="6 months ago" --name-only --pretty=format: \
|
||||
| sort | uniq -c | sort -rn | head -20
|
||||
|
||||
# 매 의 의 의 file 의 의 cyclomatic complexity 의 의
|
||||
npx complexity-report-cli src/
|
||||
# → churn high + complexity high 의 의 의 refactor 의 의
|
||||
```
|
||||
|
||||
### Structured logging (observability)
|
||||
```ts
|
||||
import pino from 'pino';
|
||||
const log = pino({ level: process.env.LOG_LEVEL ?? 'info' });
|
||||
|
||||
async function checkout(userId: string, cartId: string) {
|
||||
log.info({ userId, cartId, op: 'checkout.start' });
|
||||
try {
|
||||
const result = await processOrder(cartId);
|
||||
log.info({ userId, cartId, total: result.total, op: 'checkout.ok' });
|
||||
return result;
|
||||
} catch (e) {
|
||||
log.error({ userId, cartId, err: e, op: 'checkout.fail' });
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### "Why" comment (의 "what")
|
||||
```ts
|
||||
// 매 BAD: 의 의 의 의
|
||||
// increment counter
|
||||
counter++;
|
||||
|
||||
// 매 GOOD: explains why
|
||||
// 매 retry budget exhausted — fall through to dead-letter queue
|
||||
// (의 spec § 3.2: retries are best-effort, not guaranteed)
|
||||
counter++;
|
||||
if (counter > MAX_RETRIES) await dlq.send(msg);
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| Greenfield project | Hexagonal boundary + ADR from day 1 |
|
||||
| Legacy refactor | Strangler fig pattern + churn-driven priority |
|
||||
| Hot path optimization | Profile first, complexity budget 매 micro-optimization 의 |
|
||||
| Team < 5 | Lightweight (README + inline comments) |
|
||||
| Team > 20 | ADR + CODEOWNERS + module ownership |
|
||||
| AI-assisted maintenance | Type-strict + test-rich (의 LLM 의 의 verify) |
|
||||
|
||||
**기본값**: SRP + DI + ADR + structured log + eslint complexity rule + 70% test coverage.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Code_Quality]]
|
||||
- 변형: [[Refactoring_Best_Practices|Refactoring]] · [[Clean_Architecture]] · [[Hexagonal_Architecture]]
|
||||
- 응용: [[Technical_Debt]] · [[ADR]] · [[Code_Review]]
|
||||
- Adjacent: [[Testability]] · [[Observability]] · [[Onboarding]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: refactor proposal (extract function, rename), ADR draft, complexity review, test scaffold.
|
||||
**언제 X**: subjective architectural call (의 team consensus 의 의), legacy domain knowledge (의 인터뷰 의 의).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **God class / God function**: 의 1000-line 의 의 — split.
|
||||
- **Premature abstraction**: 매 1 use case 의 의 abstract base class — YAGNI.
|
||||
- **Comment 의 의 의 stale**: code 의 의 의 의 의 — 의 의 의 의 의 의 wrong 의 의.
|
||||
- **Circular dependency**: module A → B → A — refactor 의 의.
|
||||
- **Missing tests on critical path**: payment, auth — 의 coverage > 90%.
|
||||
- **Mutable global state**: 매 untestable, 의 reasoning 의 의.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Martin Fowler refactoring catalog, Clean Architecture by Uncle Bob, Google Engineering Practices, ISO/IEC 25010).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — maintainability dimensions + patterns |
|
||||
Reference in New Issue
Block a user