Files
2nd/10_Wiki/Topics/Architecture/아키텍처 패턴 지식.md
T
Antigravity Agent f8b21af4be Wiki cleanup: error-doc removal, dedup merge, link normalization
10_Wiki/Topics 대규모 정리:
- 오류 캡처/미완성 stub 문서 227개 제거
- 교차폴더 중복 43클러스터 병합 (63파일 → redirect)
- 링크명 정규화: 깨진 링크 수정·redirect 직결·개념 매핑 ~2,400건
- 카테고리 MOC 6개 신규 생성
- Graph 섹션 미해결 related-keyword 링크 10,058건 제거

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 23:52:15 +09:00

5.7 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-아키텍처-패턴-지식 아키텍처 패턴 지식 10_Wiki/Topics verified self
Architecture Patterns
Architectural Styles
none A 0.9 applied
architecture
patterns
design
2026-05-10 pending
language framework
agnostic agnostic

아키텍처 패턴 지식

매 한 줄

"매 architectural pattern 은 매 recurring problem 의 매 reusable solution 으로, 매 trade-off 가 매 명시되어야 한다". Buschmann 의 매 POSA series (1996) 이래로, 매 modern catalog (Richards/Ford 2020, Vernon 2021) 는 매 microservices, event-driven, hexagonal, modular monolith, serverless 를 매 핵심으로 다룬다.

매 핵심

매 6 fundamental styles

  • Layered (n-tier): presentation / business / data.
  • Pipe & filter: 매 streaming transformation chain.
  • Microkernel (plugin): 매 core + 매 extension.
  • Service-based: 매 monolith → 매 coarse-grained services.
  • Event-driven (broker / mediator): 매 async pub/sub.
  • Space-based: 매 in-memory data grid + 매 messaging.

매 modern patterns

  • Hexagonal (Ports & Adapters): 매 domain 매 framework-independent.
  • Clean Architecture: 매 dependency rule (outward → inward).
  • CQRS: 매 read / write 분리.
  • Event Sourcing: 매 state = 매 event sequence.
  • Saga: 매 distributed transaction via 매 compensation.
  • BFF (Backend for Frontend): 매 client-specific gateway.

매 응용

  1. 매 quality attribute → 매 pattern 매 mapping.
  2. 매 ADR 에서 매 chosen pattern 명시.
  3. 매 fitness function 으로 매 pattern adherence 검증.

💻 패턴

Hexagonal (TypeScript)

// domain/order.ts (pure)
export class Order { confirm(): Order { /*...*/ } }

// app/ports.ts
export interface OrderRepo { save(o: Order): Promise<void>; }
export interface PaymentGate { charge(amt: number): Promise<string>; }

// app/place-order.ts (use case)
export class PlaceOrder {
  constructor(private repo: OrderRepo, private pay: PaymentGate) {}
  async run(cart: Cart): Promise<Order> {
    const txn = await this.pay.charge(cart.total);
    const order = new Order(cart, txn).confirm();
    await this.repo.save(order);
    return order;
  }
}

// infra/postgres-order-repo.ts (adapter)
export class PgOrderRepo implements OrderRepo { /*...*/ }

Event-driven (Kafka, Java)

@KafkaListener(topics = "orders.placed")
public void onOrderPlaced(OrderPlacedEvent e) {
    inventoryService.reserve(e.items());
    kafka.send("inventory.reserved",
        new InventoryReservedEvent(e.orderId(), e.items()));
}

CQRS (.NET 9)

public record PlaceOrderCommand(Guid Id, List<Item> Items);
public record OrderSummaryQuery(Guid Id);

public class CommandHandler : IRequestHandler<PlaceOrderCommand, Unit> {
    public async Task<Unit> Handle(PlaceOrderCommand cmd, CancellationToken ct) {
        await writeDb.SaveAsync(new Order(cmd));
        await bus.PublishAsync(new OrderPlaced(cmd.Id));
        return Unit.Value;
    }
}

public class QueryHandler : IRequestHandler<OrderSummaryQuery, OrderSummary> {
    public Task<OrderSummary> Handle(OrderSummaryQuery q, CancellationToken ct)
        => readReplica.GetAsync<OrderSummary>(q.Id);
}

Saga (orchestration, Temporal)

@workflow.defn
class CheckoutWorkflow:
    @workflow.run
    async def run(self, order: Order) -> str:
        try:
            payment = await workflow.execute_activity(charge, order)
            inv = await workflow.execute_activity(reserve, order)
            ship = await workflow.execute_activity(ship, order)
            return ship.tracking_id
        except ActivityError:
            await workflow.execute_activity(refund, payment)
            await workflow.execute_activity(release_inventory, inv)
            raise

Modular Monolith (Spring Modulith)

@Modulith(systemName = "Shop", sharedModules = "shared")
@SpringBootApplication
public class ShopApp { }

// inventory/InventoryService.java — package-private
@ApplicationModuleListener
void on(OrderPlaced e) { reserve(e.items()); }

매 결정 기준

상황 Pattern
매 startup, single team Modular monolith
매 read >> write CQRS
매 audit / temporal queries Event Sourcing
매 cross-service workflow Saga (Temporal / orchestration)
매 polyglot frontends BFF
매 high event throughput Event-driven (Kafka)

기본값: 매 modular monolith 시작 → 매 evidence 기반 매 split.

🔗 Graph

🤖 LLM 활용

언제: 매 pattern selection rationale / 매 trade-off 비교 / 매 boilerplate generation. 언제 X: 매 final architecture decision — 매 senior architect review 필수.

안티패턴

  • Pattern over-application: 매 모든 곳 매 microservice.
  • Mixing CQRS + sync read-after-write: 매 consistency expectation 위반.
  • Saga without compensation test: 매 partial failure 매 silent.
  • Hexagonal in name only: 매 domain 매 framework annotations 의 침투.

🧪 검증 / 중복

  • Verified (Richards & Ford, Software Architecture: The Hard Parts; Vernon, Strategic Monoliths and Microservices; Buschmann, POSA Vol 1).
  • 신뢰도 A.

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — hexagonal/CQRS/saga/modulith 패턴 추가