"매 state + behavior 를 object 로 묶어 message passing 으로 협력시키는 패러다임". Smalltalk (1972) → C++/Java → 매 modern composition-over-inheritance + interface-driven 으로 진화. 매 2026 의 OOP 는 functional core + OO shell 의 hybrid 가 dominant.
매 핵심
매 4 기둥
Encapsulation: state 의 hide + 매 invariant 의 보호.
Abstraction: 매 interface 만 노출 — implementation hide.
Inheritance: 매 sub-class 의 reuse — 매 fragile base class 위험.
Polymorphism: subtype / parametric / ad-hoc — 매 substitutability.
매 modern OOP 의 best practice
Composition > Inheritance: 매 has-a >> is-a.
Program to interface: 매 concrete type 의 dependency X.
SOLID: SRP / OCP / LSP / ISP / DIP.
Immutable by default: record / data class / value object.
매 응용
UI framework (React class — but hooks shifted toward functional).
Game engine (Unity GameObject / Component).
ORM entity (JPA / SQLAlchemy / Active Record).
GUI (Swing, Qt, AppKit).
💻 패턴
Encapsulation + invariant
publicclassAccount{privatelongbalanceCents;// private = hiddenpublicvoiddeposit(longcents){if(cents<=0)thrownewIllegalArgumentException();this.balanceCents+=cents;}publiclonggetBalanceCents(){returnbalanceCents;}// 매 setter 없음 — invariant 보호}
Polymorphism (interface)
interfacePaymentMethod{charge(amountCents: number):Promise<TxResult>;}classStripeCardimplementsPaymentMethod{asynccharge(c: number){/* stripe sdk */return{ok: true};}}classPaypalimplementsPaymentMethod{asynccharge(c: number){/* paypal sdk */return{ok: true};}}asyncfunctioncheckout(pm: PaymentMethod,total: number){returnpm.charge(total);// 매 same call, different impl
}