"매 working memory 에 동시에 매 잡고 있어야 하는 정보의 양". Sweller 의 cognitive load theory (1988) 에 기반 — intrinsic, extraneous, germane 의 3-tier. 매 modern software design 의 first-principle metric — 작은 cognitive load 가 매 maintainable code 를 결정.
매 핵심
매 3 종류
Intrinsic: 문제 자체의 본질적 복잡도 (e.g., distributed consensus).
Extraneous: 표현/도구 가 만드는 인위적 복잡도 (bad naming, deep nesting).
Germane: schema 형성 과정 (learning) — useful load.
매 7±2 rule
Working memory 는 약 4-7 chunk 만 동시 처리 (Miller 1956, refined Cowan 2001).
Code 가 이 한계 넘으면 → bug, slow review, onboarding 지연.
매 응용
Function 의 line / parameter 제한 (small functions).
Module boundary 설계 — high cohesion, low coupling.
PR size 제한 (200-400 line max).
Naming convention — domain language 사용.
💻 패턴
Guard clause 로 nesting 줄임
# BAD: deep nesting (high extraneous load)defprocess(user):ifuserisnotNone:ifuser.is_active:ifuser.has_permission('write'):returndo_work(user)returnNone# GOOD: early returndefprocess(user):ifuserisNone:returnNoneifnotuser.is_active:returnNoneifnotuser.has_permission('write'):returnNonereturndo_work(user)
# Each layer translates — caller doesn't need to know inner schemaclassUserDTO:# external API shape...classUser:# domain entity...classUserRow:# DB schema...defto_domain(dto:UserDTO)->User:...defto_row(user:User)->UserRow:...
Team Topologies pattern
# Stream-aligned team owns a single bounded context# Platform team provides self-service infra# Goal: each team's cognitive load fits one team's working memoryteam:paymentsowns:[PaymentService, RefundService, payment-db]depends_on:platform:[k8s-cluster, observability]enabling:[]
매 결정 기준
상황
Approach
Function > 50 lines
Extract sub-functions or strategy
Class > 7 public methods
Split by responsibility
Team owns > 1 product area
Reorg per Team Topologies
Domain logic mixed w/ infra
Hexagonal / Clean Architecture
Onboarding > 2 weeks
Reduce coupling, write decision records
기본값: Optimize for reader, not writer — 매 reduce extraneous, accept intrinsic.