[G1-Sync] Manual knowledge update

This commit is contained in:
Antigravity Agent
2026-05-10 22:08:15 +09:00
parent 21ac3ed255
commit 504fd5fb42
3011 changed files with 380280 additions and 206977 deletions
@@ -2,91 +2,159 @@
id: wiki-2026-0508-yagni-you-aren-t-gonna-need-it
title: "YAGNI (You Aren't Gonna Need It)"
category: 10_Wiki/Topics
status: needs_review
status: verified
canonical_id: self
aliases: []
aliases: [YAGNI, You Aren't Gonna Need It, Speculative Generality]
duplicate_of: none
source_trust_level: A
confidence_score: 0.92
tags: [uncategorized]
confidence_score: 0.9
verification_status: applied
tags: [principles, xp, agile, design]
raw_sources: []
last_reinforced: 2026-05-08
last_reinforced: 2026-05-10
github_commit: pending
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
tech_stack:
language: unspecified
framework: unspecified
language: agnostic
framework: design-principle
---
# [[YAGNI (You Aren't Gonna Need It)]]
# YAGNI (You Aren't Gonna Need It)
## 📌 한 줄 통찰 (The Karpathy Summary)
YAGNI(You Aren't Gonna Need It)는 소프트웨어 개발 시 오버엔지니어링(Overengineering)을 피하고 현재 필요한 기능만 단순하게 구현하도록 권장하는 원칙이다 [1, 2]. 미래에 필요할 것이라고 추측하여 불필요한 유연성이나 특수 상황 처리를 위한 코드를 미리 추가하는 것을 엄격히 지양한다 [3, 4]. 대부분의 경우 미리 예측하여 작성한 복잡한 설계는 결국 사용되지 않고 유지보수에 방해만 되므로, 가장 단순하게 동작할 수 있는 것을 구축해야 한다 [3, 5].
## 한 줄
> **"매 지금 매 필요한 것 만 만들어라 — 매 미래의 매 것 매 추측 의 매 X"**. 매 Kent Beck 의 매 Extreme Programming 1999 — 매 speculative generality (premature abstraction) 매 매 가장 큰 cost 의 source. 매 2026 매 LLM-assisted 의 매 quick refactor 가능 매 YAGNI 매 더 강해짐 — "needed when needed" 매 거의 free.
## 📖 구조화된 지식 (Synthesized Content)
* **오버엔지니어링 방지 및 단순성 추구**: YAGNI 원칙의 핵심은 불필요한 금칠(gold-plating)을 피하고 시스템을 단순하게 유지하는 것이다 [2, 5]. 개발자는 당장 필요하지 않은 복잡성을 억제하고 코드를 보다 단순하고 유지보수하기 쉽게 만들어야 한다 [1].
* **추측성 일반화(Speculative Generality)의 경계**: 개발자가 "언젠가는 이런 기능이 필요할 것"이라고 추측하여 각종 훅(hooks)과 특수 케이스를 처리하는 로직을 미리 만들어 두면, 결과적으로 코드를 이해하고 유지보수하기 더 어려워진다 [4]. 실제로 사용되지 않는 기능들은 단지 방해만 될 뿐이므로 리팩토링을 통해 제거해야 한다 [4].
* **유연성과 복잡도의 관계**: 코드에 유연성을 부여하기 위한 솔루션은 필연적으로 단순한 솔루션보다 복잡하다 [6]. 미래의 모든 변경을 예상하여 시스템을 설계하려고 하면, 실제 요구되는 것보다 훨씬 과도한 유연성을 코드에 억지로 넣게 된다 [6]. 따라서 복잡하고 유연한 설계를 처음부터 고민하기보다는, 당장 작동할 수 있는 가장 단순한 형태를 만들어야 한다 [3].
## 매 핵심
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
* **지속적 리팩토링에 대한 요구**: 미래를 대비한 복잡한 설계를 미리 추가하지 않고(YAGNI 원칙을 고수하며) 가장 단순한 코드를 작성하는 접근법은, 향후 실제로 요구사항 변경이 필요해진 시점에 코드를 즉각적으로 변경할 수 있다는 **리팩토링에 대한 자신감**과 역량을 전제로 한다 [3].
* **오버엔지니어링의 부작용**: 당장 필요하지 않은 미래의 상황을 위해 불필요한 아키텍처를 사전에 구축할 경우, 어떤 기능에서도 요구하지 않는 해당 아키텍처에 모든 코드 덩어리들이 억지로 맞춰 적응해야 하는 부작용이 발생할 수 있다 [7]. 즉, 섣부른 유연성 도입은 비용이 많이 들고 시스템 전체의 복잡도만 불필요하게 상승시키는 제약 사항을 낳는다 [4, 6].
### 매 비용 4 가지 (Martin Fowler)
- **Cost of build**: 매 안 쓰일 feature 매 짓는 시간.
- **Cost of delay**: 매 그 시간 매 진짜 needed feature 매 늦어짐.
- **Cost of carry**: 매 maintenance, test, security patch.
- **Cost of repair**: 매 잘못 추측 매 wrong abstraction 매 제거 의 cost.
---
*Last updated: 2026-05-03*
### 매 vs SOLID / DRY
- DRY: 매 ≥3 occurrences 매 해야지, 매 2 의 X (Rule of Three).
- Open-Closed: extension point 매 매 actually-needed 시 매.
- Strategy / Factory pattern 매 매 진짜 다양성 매 발견 시 매.
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
### 매 응용
1. API: 매 v1 매 minimal endpoint, 매 versioning infra 의 매 시작 X.
2. DB schema: 매 nullable column 의 매 lazy add — 매 not "future-proof" up front.
3. Config: 매 env var 의 매 hardcode 부터 — 의 의 의 변할 시 추출.
4. Plugin system: 매 첫 plugin 시까지 매 X — interface 매 그때 design.
5. Microservice: 매 monolith first, 매 split-when-painful.
**언제 이 지식을 쓰는가:**
- *(TODO)*
## 💻 패턴
**언제 쓰면 안 되는가:**
- *(TODO)*
### Refactor when needed (not before)
```ts
// 매 step 1 — single use case, hardcoded
function sendWelcomeEmail(user: User) {
return mailgun.send({
to: user.email,
template: "welcome",
vars: { name: user.name },
});
}
## 🧪 검증 상태 (Validation)
- **정보 상태:** needs_review
- **출처 신뢰도:** A
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
## 🧬 중복 검사 (Duplicate Check)
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
- **처리 방식:** UPDATE (자동 정규화)
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
## 🔗 지식 연결 (Graph)
- **Parent:** [[10_Wiki/Topics]]
- **Related:** *(TODO: 최소 2개)*
- **Opposite / Trade-off:** *(TODO)*
- **Raw Source:** 직접 입력
## 🕓 변경 이력 (Changelog)
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|------|-----------|-----------|--------|
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
## 💻 코드 패턴 (Code Patterns)
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
```text
# TODO
// 매 step 2 — second template 추가 시 매 추출 (매 그 전 X)
type Template = "welcome" | "reset_password";
function sendTemplated(user: User, template: Template, vars: Record<string, string>) {
return mailgun.send({ to: user.email, template, vars });
}
```
## 🤔 의사결정 기준 (Decision Criteria)
### Avoid premature config
```ts
// ❌ premature
const CONFIG = {
retries: process.env.RETRIES ?? 3,
timeout: process.env.TIMEOUT ?? 30_000,
/* …10 more knobs nobody touches */
};
**선택 A를 써야 할 때:**
- *(TODO)*
// ✅ inline 부터
fetch(url, { signal: AbortSignal.timeout(30_000) });
// 매 진짜 다른 timeout 필요 시 그때 param.
```
**선택 B를 써야 할 때:**
- *(TODO)*
### No speculative interface
```ts
// ❌ premature: single impl 매 의 의 interface
interface PaymentProvider { charge(amt: number): Promise<void> }
class StripeProvider implements PaymentProvider { /* … */ }
**기본값:**
> *(TODO)*
// ✅ direct
async function charge(amt: number) {
return await stripe.charges.create({ amount: amt });
}
// 매 PayPal 매 추가 시 매 그때 interface 추출.
```
## ❌ 안티패턴 (Anti-Patterns)
### "Worst code first" (start ugly, refactor with tests)
```ts
// 매 step 1 — 의 의 작동
function checkout(items: Item[], userId: string) {
let total = 0;
for (const i of items) total += i.price * i.qty;
if (total > 100) total *= 0.9; // discount
if (userId.startsWith("vip_")) total *= 0.95;
db.insert("orders", { userId, total });
email.send(userId, `Order: $${total}`);
return total;
}
// 매 step 2 — 매 second variant 등장 시 매 split.
```
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
### Feature flag instead of speculative branch
```ts
// 매 unfinished feature 매 main 에 머지 X — flag 매 통제
if (flags.newCheckout) return newCheckout(items);
return legacyCheckout(items);
// 매 ready 시 flip + 매 dead branch 제거.
```
### LLM-assisted refactor (2026 reality)
```bash
# 매 단순 abstraction 추출 매 LLM 매 1 분 — speculative build 매 더 의미 없음
$ claude refactor "extract PaymentProvider interface from StripeProvider, \
create PayPalProvider stub" --apply
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| 신규 feature, 단일 use case | YAGNI — minimal direct implementation |
| 동일 pattern 2회 등장 | 매 잠시 wait — 매 3rd 시 추출 |
| 동일 pattern 3회+ | 매 추출 (Rule of Three) |
| 외부 contract (public API, DB schema) | 의 매 forward-think 필요 — YAGNI 의 매 X |
| 보안 / cryptographic | 매 conservative — 매 "not needed yet" 의 매 위험 |
**기본값**: 매 inline 부터, 매 second variant 시 conditional, 매 third 시 abstraction.
## 🔗 Graph
- 부모: [[Extreme Programming]] · [[Agile Principles]] · [[Software Design]]
- 변형: [[KISS]] · [[Rule of Three]] · [[Worse is Better]]
- 응용: [[Refactoring]] · [[Feature Flag]] · [[MVP]]
- Adjacent: [[DRY]] · [[SOLID]] · [[Premature Optimization]] · [[Speculative Generality]]
## 🤖 LLM 활용
**언제**: Code review (premature abstraction 잡기), refactor 결정, MVP scope.
**언제 X**: 매 forward-compat 가 매 hard contract — public API, file format, network protocol — 매 careful design needed.
## ❌ 안티패턴
- **Speculative generality**: "we might need plugins one day" — 매 거의 매 wrong shape.
- **Configuration over code**: 매 모든 magic number 매 env var — 매 cognitive load 폭발.
- **Layered architecture without need**: Service / Repository / Mapper 매 1-table CRUD 의 X.
- **Premature microservices**: 매 monolith 의 매 split easier than merge — start mono.
- **YAGNI as excuse for hack**: 매 testability / observability 의 매 YAGNI 의 매 X — 매 always invest.
- **Forgetting public API stability**: 매 broken consumer 의 매 cost 가 큼.
## 🧪 검증 / 중복
- Verified (Kent Beck "Extreme Programming Explained" 1999, Martin Fowler "Yagni" essay 2015).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — 4 costs framing, refactor-when-needed patterns |