"매 essential 의 의 keep, 매 incidental 의 의 hide". 매 complexity management 의 의 의 의 의 핵심 의 mechanism — 매 detail 의 의 selectively 의 의 의 reveal 의 의 conceptual model 의 의 의 expose. 매 SOLID 의 D (Dependency Inversion) 의 의 의 foundation.
매 핵심
매 Abstraction 의 의 의 forms
Procedural — 매 function 의 의 의 의 의 step 의 hide.
Data — 매 representation 의 의 의 의 hide (ADT).
Control — 매 flow 의 의 의 hide (iterator, async).
Type — 매 generic / parametric polymorphism.
Interface — 매 contract 의 의 의 의 의 expose, impl 의 의 의 hide.
매 Levels of abstraction
High — 매 business domain ("place order").
Mid — 매 application logic ("validate cart").
Low — 매 implementation ("HTTP POST").
Hardware — 매 CPU instruction.
매 핵심 properties
Information hiding (Parnas, 1972) — 매 client 의 의 의 의 implementation 의 의 의 X.
Encapsulation — 매 state + behavior 의 의 의 의 bundle.
Substitutability (LSP) — 매 abstraction 의 의 의 의 의 satisfy 의 implementation 의 의 의 의 swap 의 의 가능.
매 vs Encapsulation
매 Abstraction = 매 "what" — 매 의 logical model.
매 Encapsulation = 매 "how" — 매 mechanism (private, accessor).
fromabcimportABC,abstractmethodclassStack[T](ABC):@abstractmethoddefpush(self,item:T)->None:...@abstractmethoddefpop(self)->T:...@abstractmethoddefpeek(self)->T:...@abstractmethoddefis_empty(self)->bool:...# 매 ArrayList 의 의 의 implementation, LinkedList 의 의 의 의 implementation — 매 swap 가능
매 Interface (contract)
interfacePaymentGateway{charge(userId: string,amount: Money):Promise<ChargeResult>;refund(chargeId: string):Promise<RefundResult>;}classStripeGatewayimplementsPaymentGateway{/* ... */}classAdyenGatewayimplementsPaymentGateway{/* ... */}classFakeGatewayimplementsPaymentGateway{/* test */}
매 Dependency inversion
// 매 High-level 의 의 의 abstraction 의 의 의 의 의 depend, 매 low-level impl 의 의 의 X.classOrderService{privatefinalPaymentGatewaygateway;// 매 abstractionpublicOrderService(PaymentGatewaygw){this.gateway=gw;}}
deffirst_match(items:Iterable[T],pred:Callable[[T],bool])->T|None:foriteminitems:ifpred(item):returnitemreturnNone# 매 list, generator, file, stream 의 의 모두 의 의 의 work
매 Leaky abstraction (Joel Spolsky)
# 매 Bad — 매 underlying TCP 의 의 의 의 의 leakdefsend(msg):try:socket.send(msg)exceptConnectionResetError:...# 매 abstraction 의 의 의 의 의 break# 매 Better — 매 wrapclassMessageBus:defsend(self,msg)->SendResult:try:self._socket.send(msg);returnSendResult.OKexcept:returnSendResult.RETRY
매 Higher-Kinded abstraction
traitFunctor[F[_]]{defmap[A, B](fa:F[A])(f:A=>B):F[B]}// 매 List, Option, Future 의 의 모두 의 Functor — 매 abstraction 의 의 의 매 type constructor 의 의 over
매 결정 기준
상황
Approach
매 detail 의 의 의 client 의 의 의 의 X 의 의 needed
매 hide via 매 interface
매 multiple impl 의 의 의 expected
매 abstract class / interface
매 single use, single impl
매 직접 — 매 premature abstraction 의 X
매 stable detail
매 leak 의 의 의 의 의 fine — 매 simplicity 의 win
매 cross-process boundary
매 strong abstraction (RPC, queue)
기본값: 매 rule of three — 매 셋 의 의 의 의 의 occur 의 의 의 의 abstract.
언제: 매 design — 매 boundary 의 의 의 draw, 매 변경 의 의 absorb 의 의 의 abstraction layer 의 의 의 introduce.
언제 X: 매 single-call site, 매 prototype — 매 premature abstraction 의 의 의 cost.
❌ 안티패턴
Premature abstraction: 매 한 implementation 의 의 의 의 의 interface 의 의 introduce — 매 noise.
Leaky abstraction: 매 underlying detail 의 의 의 의 surface — 매 client 의 의 의 의 know 의 의 force.
God interface: 매 모든 의 method 의 의 의 의 한 interface 의 의 — ISP 의 violation.
Wrong abstraction (Sandi Metz): 매 잘못 의 abstraction 의 의 의 duplication 의 의 보다 의 worse.
🧪 검증 / 중복
Verified — Parnas (1972) "On the Criteria To Be Used in Decomposing Systems"; Joel Spolsky "Law of Leaky Abstractions"; Sandi Metz, Practical Object-Oriented Design.
신뢰도 A.
🕓 Changelog
날짜
변경
2026-05-08
Phase 1
2026-05-10
Manual cleanup — abstraction forms + leaky / wrong-abstraction discussion