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 폴더 제거.
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) |