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,194 @@
|
||||
---
|
||||
id: wiki-2026-0508-component-based-architecture-cba
|
||||
title: Component Based Architecture (CBA)
|
||||
category: 10_Wiki/Topics
|
||||
status: verified
|
||||
canonical_id: self
|
||||
aliases: [CBA, Component-Based Software Engineering, CBSE]
|
||||
duplicate_of: none
|
||||
source_trust_level: A
|
||||
confidence_score: 0.9
|
||||
verification_status: applied
|
||||
tags: [architecture, components, modularity, reuse]
|
||||
raw_sources: []
|
||||
last_reinforced: 2026-05-10
|
||||
github_commit: pending
|
||||
tech_stack:
|
||||
language: typescript
|
||||
framework: react-vue-angular
|
||||
---
|
||||
|
||||
# Component Based Architecture (CBA)
|
||||
|
||||
## 매 한 줄
|
||||
> **"매 시스템 = 매 independent, replaceable, composable component 의 합."**. CBSE는 1960s OOP의 reuse 약속을 modular contract로 실현한 패러다임. 2026년 frontend (React/Vue/Angular), microservices, design systems, embedded (OSGi), game engines (Unity ECS) 모두 CBA의 변형.
|
||||
|
||||
## 매 핵심
|
||||
|
||||
### 매 component 의 정의
|
||||
- **Encapsulation**: state + behavior + interface = 단일 unit.
|
||||
- **Well-defined contract**: input props/events, output events, side effects 명시.
|
||||
- **Replaceable**: 동일 interface 의 다른 impl 으로 swap 가능.
|
||||
- **Independently deployable** (microservices) 또는 **independently versionable** (libraries).
|
||||
|
||||
### 매 4 properties (Szyperski)
|
||||
1. **Independent deployment** unit.
|
||||
2. **Composition** by third parties.
|
||||
3. **No persistent state** (pure or state-injected).
|
||||
4. **Explicit context dependencies** (interface 로 명시).
|
||||
|
||||
### 매 응용
|
||||
1. Frontend UI (React component tree).
|
||||
2. Microservices (service = component).
|
||||
3. Plugin systems (VSCode extensions, Figma plugins).
|
||||
4. Game engines (Unity GameObject + Components).
|
||||
5. Web Components (Custom Elements, Shadow DOM).
|
||||
|
||||
## 💻 패턴
|
||||
|
||||
### React functional component
|
||||
```typescript
|
||||
type ButtonProps = {
|
||||
variant: 'primary' | 'ghost';
|
||||
onClick: () => void;
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
export function Button({ variant, onClick, children }: ButtonProps) {
|
||||
return (
|
||||
<button
|
||||
className={`btn btn-${variant}`}
|
||||
onClick={onClick}
|
||||
>
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Web Component (framework-agnostic)
|
||||
```typescript
|
||||
class TodoItem extends HTMLElement {
|
||||
static observedAttributes = ['done', 'label'];
|
||||
|
||||
attributeChangedCallback(name: string, _old: string, value: string) {
|
||||
this.render();
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
this.attachShadow({ mode: 'open' });
|
||||
this.render();
|
||||
}
|
||||
|
||||
private render() {
|
||||
if (!this.shadowRoot) return;
|
||||
const done = this.hasAttribute('done');
|
||||
this.shadowRoot.innerHTML = `
|
||||
<style>:host { display: block; }</style>
|
||||
<label>
|
||||
<input type="checkbox" ${done ? 'checked' : ''} />
|
||||
<span>${this.getAttribute('label') ?? ''}</span>
|
||||
</label>
|
||||
`;
|
||||
}
|
||||
}
|
||||
customElements.define('todo-item', TodoItem);
|
||||
```
|
||||
|
||||
### Composition over inheritance
|
||||
```typescript
|
||||
// Bad: deep inheritance
|
||||
class AdminButton extends IconButton extends Button { }
|
||||
|
||||
// Good: composition
|
||||
function AdminButton({ icon, ...rest }: AdminButtonProps) {
|
||||
return (
|
||||
<Button {...rest}>
|
||||
<Icon name={icon} />
|
||||
<span>{rest.children}</span>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### Dependency injection (explicit context)
|
||||
```typescript
|
||||
type Logger = { info(msg: string): void };
|
||||
|
||||
export function createPaymentService({ logger, gateway }: {
|
||||
logger: Logger;
|
||||
gateway: PaymentGateway;
|
||||
}) {
|
||||
return {
|
||||
charge: async (amount: number) => {
|
||||
logger.info(`charging ${amount}`);
|
||||
return gateway.charge(amount);
|
||||
},
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### ECS component (Unity / Bevy style)
|
||||
```rust
|
||||
// Bevy ECS
|
||||
#[derive(Component)]
|
||||
struct Position { x: f32, y: f32 }
|
||||
|
||||
#[derive(Component)]
|
||||
struct Velocity { dx: f32, dy: f32 }
|
||||
|
||||
fn movement_system(mut query: Query<(&mut Position, &Velocity)>) {
|
||||
for (mut pos, vel) in &mut query {
|
||||
pos.x += vel.dx;
|
||||
pos.y += vel.dy;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Microservice as component
|
||||
```typescript
|
||||
// Each service exposes a typed contract (gRPC / OpenAPI)
|
||||
interface OrderService {
|
||||
createOrder(req: CreateOrderRequest): Promise<Order>;
|
||||
getOrder(id: string): Promise<Order>;
|
||||
}
|
||||
|
||||
// Replaceable impl: REST, gRPC, in-memory mock
|
||||
```
|
||||
|
||||
## 매 결정 기준
|
||||
| 상황 | Approach |
|
||||
|---|---|
|
||||
| UI rendering | React/Vue functional components |
|
||||
| Cross-framework UI | Web Components (Lit) |
|
||||
| Backend domain split | Microservice components (gRPC contract) |
|
||||
| Game logic | ECS components (Bevy, Unity DOTS) |
|
||||
| Plugin systems | Component + manifest + sandbox (VSCode model) |
|
||||
|
||||
**기본값**: React 19 functional components + composition; backend은 module 단위 component → 필요 시 microservice 로 추출.
|
||||
|
||||
## 🔗 Graph
|
||||
- 부모: [[Modularity]] · [[Software Architecture]]
|
||||
- 변형: [[Microservices]] · [[Web Components]] · [[Entity Component System]]
|
||||
- 응용: [[Component Library Architecture]] · [[Component-Composition|Compound Components]] · [[Design Systems]]
|
||||
- Adjacent: [[Conceptual Integrity]] · [[Dependency Injection]]
|
||||
|
||||
## 🤖 LLM 활용
|
||||
**언제**: UI/system 의 reusable units 으로 분해, contract-driven team work, plugin ecosystem.
|
||||
**언제 X**: 단일 prototype, throwaway script, 하나의 tight algorithm (component overhead 가 cost > benefit).
|
||||
|
||||
## ❌ 안티패턴
|
||||
- **God component**: 하나의 component 가 too many props/responsibilities — split.
|
||||
- **Prop drilling**: 5+ levels 깊이 prop 전달 — Context/store 로 lift.
|
||||
- **Hidden coupling**: component A 가 component B 의 internal state 의 직접 접근 — contract violation.
|
||||
- **Premature genericization**: 1번만 쓰는 것을 generic 으로 추상화 — YAGNI.
|
||||
|
||||
## 🧪 검증 / 중복
|
||||
- Verified (Szyperski "Component Software" 1998 / Brooks 1995 / React docs 2026).
|
||||
- 신뢰도 A.
|
||||
|
||||
## 🕓 Changelog
|
||||
| 날짜 | 변경 |
|
||||
|---|---|
|
||||
| 2026-05-08 | Phase 1 |
|
||||
| 2026-05-10 | Manual cleanup — CBA 4-property canonical + React/ECS/microservice 패턴 |
|
||||
Reference in New Issue
Block a user