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>
6.3 KiB
6.3 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-object-oriented-programming | Object-Oriented Programming (OOP) | 10_Wiki/Topics | verified | self |
|
none | A | 0.95 | applied |
|
2026-05-10 | pending |
|
Object-Oriented Programming (OOP)
매 한 줄
"매 data + behavior를 object로 묶고, polymorphism으로 동작을 추상화하는 패러다임.". Simula 67 (1967) → Smalltalk (1972) → C++ (1985) → Java (1995) → 매 mainstream. 2026 현재는 OO + FP hybrid가 dominant — Java records, Kotlin data class, TypeScript readonly class, Rust trait이 그 증거.
매 핵심
매 4 pillar
- Encapsulation: 매 internal state hide, expose behavior —
privatefield +publicmethod. - Inheritance: 매 reuse + specialize — 단 favor composition over inheritance (GoF).
- Polymorphism: 매 same interface, different impl — virtual dispatch · duck typing.
- Abstraction: 매 essential 만 expose — interface · abstract class.
매 SOLID (Robert C. Martin)
- Single Responsibility — 매 class one reason to change.
- Open/Closed — 매 extend without modify.
- Liskov Substitution — 매 subtype substitutable.
- Interface Segregation — 매 small focused interfaces.
- Dependency Inversion — 매 depend on abstraction.
매 응용
- Domain-Driven Design — Entity, Value Object, Aggregate.
- GUI framework — Component hierarchy (React class component, Qt widget).
- Game engine — Entity-Component-System (modern hybrid).
💻 패턴
Encapsulation — invariant 보장
public final class Money {
private final BigDecimal amount;
private final Currency currency;
public Money(BigDecimal a, Currency c) {
if (a.signum() < 0) throw new IllegalArgumentException("negative");
this.amount = a; this.currency = c;
}
public Money add(Money other) {
if (!currency.equals(other.currency))
throw new IllegalStateException("currency mismatch");
return new Money(amount.add(other.amount), currency);
}
}
Polymorphism — strategy
interface Shipping {
calculate(weight: number): number;
}
class StandardShipping implements Shipping {
calculate(w: number) { return w * 5; }
}
class ExpressShipping implements Shipping {
calculate(w: number) { return w * 12 + 10; }
}
function totalCost(items: Item[], shipping: Shipping): number {
const w = items.reduce((s, i) => s + i.weight, 0);
return items.reduce((s, i) => s + i.price, 0) + shipping.calculate(w);
}
Composition over inheritance
// BAD: deep hierarchy
class Animal {}
class Dog extends Animal {}
class FlyingDog extends Dog {} // ???
// GOOD: composition
class Animal {
constructor(
private mover: Movement,
private noise: NoiseMaker,
) {}
move() { return this.mover.move(); }
speak() { return this.noise.sound(); }
}
const dog = new Animal(new Walking(), new Bark());
const bird = new Animal(new Flying(), new Chirp());
Abstract class + template method
public abstract class HttpHandler {
public final Response handle(Request req) {
if (!authenticate(req)) return Response.unauthorized();
var data = process(req);
return render(data);
}
protected abstract boolean authenticate(Request req);
protected abstract Object process(Request req);
protected Response render(Object data) {
return Response.ok().json(data);
}
}
Modern hybrid — record (Java 21) / data class
public record User(UserId id, Email email, String name) {
public User { // compact constructor
Objects.requireNonNull(email);
if (name.isBlank()) throw new IllegalArgumentException();
}
public User withName(String n) { return new User(id, email, n); }
}
Trait-based OOP (Rust)
trait Drawable {
fn draw(&self, canvas: &mut Canvas);
fn bounds(&self) -> Rect;
}
struct Circle { center: Point, r: f32 }
impl Drawable for Circle {
fn draw(&self, c: &mut Canvas) { c.circle(self.center, self.r); }
fn bounds(&self) -> Rect { Rect::around(self.center, self.r) }
}
fn render_all(shapes: &[Box<dyn Drawable>], canvas: &mut Canvas) {
for s in shapes { s.draw(canvas); }
}
매 결정 기준
| 상황 | Approach |
|---|---|
| Domain with complex invariants | OOP + DDD entities/VO |
| Pure data transformation | FP (immutable + pure functions) |
| Plug-in / extensibility | Interface + DI |
| State machine | OOP class with explicit states |
| Hot loop, ECS scale | Data-Oriented (avoid virtual dispatch) |
기본값: hybrid OOP+FP — value objects immutable, services with interfaces, pure functions for transforms.
🔗 Graph
- 변형: Functional_Programming · Procedural-Architecture-Systems · ECS
- 응용: SOLID Principles · Polymorphism (다형성) · Object Seam (객체 접점) · Bounded_Context
- Adjacent: High-Cohesion-Low-Coupling · Dependency_Inversion_Principle · Hexagonal_Architecture_Ports_and_Adapters
🤖 LLM 활용
언제: business domain modeling, framework/library design, GUI hierarchy, plug-in architecture. 언제 X: hot numerical loop (DOD better), pure transform pipeline (FP cleaner), 1-file script.
❌ 안티패턴
- God Object: 매 모든 책임 한 class — SRP 위반.
- Anemic Domain Model: data only, behavior in service — OOP 무력화.
- Deep inheritance (4+ levels): 매 fragile base class.
- Premature interface: 매 single impl을 interface로 — YAGNI.
- Setter everywhere: 매 invariant 깨짐 — immutable + factory.
🧪 검증 / 중복
- Verified (GoF Design Patterns 1994, Martin Clean Code 2008, Evans DDD 2003, Java/Kotlin/Rust 2026 docs).
- 신뢰도 A.
- Duplicates:
객체_지향_프로그래밍(OOP).md,객체_지향_프로그래밍_Object-Oriented_Programming,_OOP.mdshould redirect here.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — canonical OOP doc (4 pillars + SOLID + modern hybrid) |