docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
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 폴더 제거.
This commit is contained in:
@@ -0,0 +1,228 @@
|
||||
---
|
||||
id: wiki-2026-0508-architecture-styles
|
||||
title: Software Architecture Styles
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [아키텍처 스타일, architecture styles, system architecture, design patterns]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.92
|
||||
verification_status: applied
|
||||
tags: [architecture, system-design, layered, clean-architecture, ddd, microservices, eda, hexagonal]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: language-agnostic
|
||||
framework: any
|
||||
---
|
||||
|
||||
# Software Architecture Styles
|
||||
|
||||
## 📌 한 줄 통찰
|
||||
> **시스템 의 component 의 구성 + interaction 의 fundamental pattern**. 매 codebase 의 first read 의 shortcut. 매 wrong style = 매 매 fight 매 month. **선택 기준 = team + scale + change frequency**.
|
||||
|
||||
## 📖 핵심
|
||||
|
||||
### 매 5 가지 major style
|
||||
|
||||
#### 1. Layered (계층형)
|
||||
- 매 horizontal layer: Presentation → Business → Data.
|
||||
- 매 strict downward dependency.
|
||||
- ✅ 매 simple. ✅ 매 entry-level.
|
||||
- ❌ 매 cross-cutting concern (logging, auth) 의 awkward.
|
||||
- ❌ 매 layer 의 leak 의 architecture 의 부패.
|
||||
|
||||
#### 2. Clean Architecture (Uncle Bob)
|
||||
- 매 entity / use case 의 center.
|
||||
- 매 framework / DB 의 outer layer (adapter).
|
||||
- 매 dependency 의 inward.
|
||||
- ✅ 매 testable, framework-independent.
|
||||
- ❌ 매 boilerplate (port + adapter).
|
||||
|
||||
#### 3. Hexagonal (Ports & Adapters)
|
||||
- 매 Clean 의 변형.
|
||||
- 매 input port (use case) + output port (repository).
|
||||
- ✅ 매 testable. ✅ 매 swap-able tech.
|
||||
|
||||
#### 4. DDD (Domain-Driven Design)
|
||||
- 매 module 의 Bounded Context.
|
||||
- 매 ubiquitous language.
|
||||
- 매 Entity / Value Object / Aggregate.
|
||||
- ✅ 매 complex business.
|
||||
- ❌ 매 simple CRUD 의 over-engineering.
|
||||
|
||||
#### 5. Microservices
|
||||
- 매 small + independent service.
|
||||
- 매 single business capability.
|
||||
- ✅ 매 scale + team autonomy.
|
||||
- ❌ 매 distributed complexity (network, data consistency, observability).
|
||||
|
||||
#### 6. Event-Driven (EDA)
|
||||
- 매 message broker (Kafka, RabbitMQ).
|
||||
- 매 producer + consumer 의 async.
|
||||
- ✅ 매 decoupling. ✅ 매 scale.
|
||||
- ❌ 매 ordering / debugging 어려움.
|
||||
|
||||
#### 7. Serverless
|
||||
- 매 FaaS (Lambda).
|
||||
- 매 stateless function.
|
||||
- ✅ 매 cost (idle 0).
|
||||
- ❌ 매 cold start. 매 vendor lock-in.
|
||||
|
||||
### 매 trade-off matrix
|
||||
| Style | Complexity | Scale | Team | Cost |
|
||||
|---|---|---|---|---|
|
||||
| Monolith | Low | Low-Mid | Small | Low |
|
||||
| Layered | Low | Mid | Small-Mid | Low |
|
||||
| Clean | Mid | Mid | Mid | Mid |
|
||||
| DDD | High | Mid-High | Mid-Large | High |
|
||||
| Microservices | High | High | Large | High |
|
||||
| EDA | High | Very High | Mid-Large | Mid |
|
||||
| Serverless | Mid | Auto | Small-Mid | Variable |
|
||||
|
||||
### 매 architecture drift
|
||||
- 매 time 의 codebase 가 design 에서 멀어짐.
|
||||
- 매 layer violation 의 build-time check (`tsc-strict`, `archunit`, `dependency-cruiser`).
|
||||
- 매 ADR (Architecture Decision Record) 의 history.
|
||||
|
||||
### 매 anti-corruption layer (ACL)
|
||||
- 매 external system 의 model 의 leak 방지.
|
||||
- 매 boundary 의 translation.
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### Clean Architecture (TS)
|
||||
```ts
|
||||
// domain/entities/User.ts (no framework)
|
||||
export class User {
|
||||
constructor(public id: string, public email: string) {}
|
||||
changeEmail(newEmail: string) {
|
||||
if (!isValidEmail(newEmail)) throw new InvalidEmail();
|
||||
this.email = newEmail;
|
||||
}
|
||||
}
|
||||
|
||||
// application/usecases/UpdateUser.ts
|
||||
export class UpdateUserUseCase {
|
||||
constructor(private userRepo: UserRepository) {}
|
||||
async execute(id: string, email: string) {
|
||||
const user = await this.userRepo.findById(id);
|
||||
user.changeEmail(email);
|
||||
await this.userRepo.save(user);
|
||||
}
|
||||
}
|
||||
|
||||
// application/ports/UserRepository.ts (interface)
|
||||
export interface UserRepository {
|
||||
findById(id: string): Promise<User>;
|
||||
save(user: User): Promise<void>;
|
||||
}
|
||||
|
||||
// infrastructure/PrismaUserRepository.ts (adapter)
|
||||
export class PrismaUserRepository implements UserRepository {
|
||||
async findById(id: string) { /* prisma ... */ }
|
||||
async save(user: User) { /* prisma ... */ }
|
||||
}
|
||||
```
|
||||
|
||||
→ 매 dependency 가 inward. 매 domain 가 prisma 의 모름.
|
||||
|
||||
### Hexagonal port
|
||||
```ts
|
||||
// 매 input port
|
||||
interface CreateOrder { execute(cmd: CreateOrderCommand): Promise<OrderId>; }
|
||||
|
||||
// 매 output port
|
||||
interface OrderRepository { save(o: Order): Promise<void>; }
|
||||
interface PaymentGateway { charge(amount: Money): Promise<TxId>; }
|
||||
|
||||
class CreateOrderHandler implements CreateOrder {
|
||||
constructor(private repo: OrderRepository, private payment: PaymentGateway) {}
|
||||
async execute(cmd: CreateOrderCommand) {
|
||||
const order = Order.create(cmd);
|
||||
const tx = await this.payment.charge(order.total);
|
||||
order.confirmPayment(tx);
|
||||
await this.repo.save(order);
|
||||
return order.id;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### EDA (Kafka)
|
||||
```ts
|
||||
// Producer
|
||||
await producer.send({
|
||||
topic: 'order.created',
|
||||
messages: [{ key: order.id, value: JSON.stringify(order) }],
|
||||
});
|
||||
|
||||
// Consumer
|
||||
await consumer.subscribe({ topic: 'order.created' });
|
||||
consumer.run({
|
||||
eachMessage: async ({ message }) => {
|
||||
const order = JSON.parse(message.value!.toString());
|
||||
await sendConfirmationEmail(order);
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
### Architecture test (dependency-cruiser)
|
||||
```js
|
||||
// .dependency-cruiser.js
|
||||
module.exports = {
|
||||
forbidden: [
|
||||
{
|
||||
name: 'no-domain-to-infra',
|
||||
severity: 'error',
|
||||
from: { path: '^src/domain' },
|
||||
to: { path: '^src/infrastructure' },
|
||||
},
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
→ 매 layer violation 의 CI 에서 catch.
|
||||
|
||||
## 🤔 결정 기준
|
||||
| 상황 | 추천 |
|
||||
|---|---|
|
||||
| Solo / MVP | Monolith + Layered |
|
||||
| Small team + complex business | Clean / Hexagonal |
|
||||
| Large team + multi-domain | DDD + Microservices |
|
||||
| Async / event-heavy | EDA |
|
||||
| Variable load | Serverless |
|
||||
| Legacy refactor | Strangler Fig (incremental) |
|
||||
|
||||
**기본값**: Modular Monolith (DDD inside) → 매 scale 가 명확 후 Microservices.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[System-Design]]
|
||||
- 변형: [[Layered-Architecture]] · [[Clean-Architecture]] · [[Hexagonal Architecture]] · [[Domain-Driven-Design]] · [[Microservices]] · [[Event-Driven-Architecture]]
|
||||
- 응용: [[CQRS]] · [[Event Sourcing]] · [[Serverless]] · [[Strangler-Fig]]
|
||||
- 검증: [[ADR]] · [[C4 Model (Architecture Documentation)]] · [[Dependency-Cruiser]] · [[ArchUnit]]
|
||||
- Adjacent: [[SOLID]] · [[Design-Patterns]] · [[Anaemic Domain Model]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: 매 system design review. 매 codebase 의 first read. 매 architecture decision.
|
||||
**언제 X**: 매 single-file script. 매 throwaway prototype.
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **Premature microservices**: 매 distributed monolith.
|
||||
- **Layered 의 strict 무시**: 매 leak 의 부패.
|
||||
- **Clean architecture 의 small project**: 매 over-engineering.
|
||||
- **DDD 의 simple CRUD**: 매 boilerplate.
|
||||
- **EDA 의 sync expectation**: 매 ordering bug.
|
||||
- **No ADR**: 매 future-self 의 confusion.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Uncle Bob, Eric Evans, Sam Newman).
|
||||
- 신뢰도 A.
|
||||
- Related: [[Domain-Driven-Design]] · [[Clean-Architecture]] · [[Microservices]].
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — 5 styles + trade-off + Clean code + dependency-cruiser |
|
||||
Reference in New Issue
Block a user